[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: Greg Thomas <thomasgd_at_omc.bt.co.uk>
Date: 2005-06-02 10:11:51 CEST

On Wed, 01 Jun 2005 14:31:08 -0400, Christopher Ness
<chris@nesser.org> wrote:

>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.

I'm not planning to alter a commit transaction. I'm modifying a
property (which isn't version controlled anyway) *after* a commit
transaction. I understand why you can't modify a commit in a
pre-commit hook, but I don't see any issues in updating the repository
in a post-commit hook.

...
>> 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$

That's fine for application/octet-stream files, but what about other
mime-types - GIFs, PNGs, Word, Excel, etc. I'd need an exhaustive list
of all binary types. Given that svn has already identified the file as
binary when it was added, I was hoping to use that identification.

Greg

-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jun 2 10:14:03 2005

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