[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Determining which files are treated as binary

From: Christopher Ness <chris_at_nesser.org>
Date: 2005-06-01 20:31:08 CEST

On Wed, 2005-06-01 at 09:25 +0100, Greg Thomas wrote:
> I'm trying to create a post-commit hook to set the svn:needs-lock
> property on binary files - which should be simple enough.

Just to nip this in the bud. You *cannot* modify a commit transaction
with a hook script. You can only reject it.

Your best bet is to have clients use a default configuration file which
identifies the binary files you wish to use.

There is talk about a global config file, but currently it is up to each
client (on the users computer) to determine their configuration.

> But, I'm having trouble determining which files are treated as binary
> by Subversion. When a new file is added, you do get a (binary) note to
> indicate this - e.g.
> Adding (bin) test.gif
> but AFAICT there's no way of pulling this binary status out using
> svnlook or another similar command suitable for use from a hook.

Depending on your OS, here is a one liner that should get you what you
want, then cut the end off and run that through xargs again to set the
need-lock property.

find . -type f | grep -v .svn | xargs svn propget "svn:mime-type" 2>/dev/null | grep application/octet-stream$

You'll get a listing like this:
ext/dom/tests/book.xml.gz - application/octet-stream
ext/xsl/tests/xslt.xsl.gz - application/octet-stream
ext/dba/tests/test.cdb - application/octet-stream

Let me explain, sections are separated by pipes `|'
1. List all the files in the current directory.
2. Filter out files in a .svn directory
3. Ask subversion if the property is set, disregard all error messages
4. Only print the files that are binary, as we could have other


Wireless Group,
McMaster University
14:11:52 up 3:19, 1 user, load average: 0.22, 0.18, 0.11
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Jun 1 20:51:24 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.