You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Steve Strobel <st...@link-comm.com> on 2008/09/18 17:23:39 UTC

Skipping binary files when "svn diff" old revisions with incorrect svn:mime-type properties

I am trying to generate a diff between two revisions with a command like

         svn diff svn://192.168.25.29/trunk@2 svn://192.168.25.29/trunk@232

Unfortunately some of the files are binary but for some reason did 
not get their svn:mime-type property set to application/octet-stream, 
which causes the diff to end up with a bunch of unreadable binary 
characters in it.  I would like diff to skip those files with a message like

         Cannot display: file marked as a binary type.
         svn:mime-type = application/octet-stream

I hoped to accomplish this by retroactively setting the svn:mime-type 
property of each such file, so I added the following to the 
pre-revprop-change hook script (*.bat file under Windows with svnserve):

         IF "%SVN_PROPNAME%" == "svn:mime-type" exit 0

I can now execute the propset command without getting an error message:

         svn propset --revprop -r 6 svn:mime-type 
application/octet-stream 
svn://192.168.25.29/trunk/vendors/AnalogDevices/RLC_DSP4/dsp4
         property 'svn:mime-type' set on repository revision 6

but it doesn't seem to work.  The diff still has the same problem and 
proplist doesn't show the property:

         svn proplist 
svn://192.168.25.29/trunk/vendors/AnalogDevices/RLC_DSP4/dsp4
         Properties on 
'svn://192.168.25.29/trunk/vendors/AnalogDevices/RLC_DSP4/dsp4':
           svn:executable

I am guessing that I can't change the properties retroactively like 
that for anything except svn:date, svn:author and svn:log because 
they are versioned and versions are immutable.  As an aside, I think 
propset should give an error message when it is unable to do what you 
ask.  I could add the property to the binary files in a working copy 
and commit them, but I don't think that is going to help me diff the 
older revisions (some of those files might not even exist in the 
working copy on head).  Is there another way to get a diff without 
the binary files mucking it up?

Thanks for any suggestions,

Steve


---
Steve Strobel
Link Communications, Inc.
1035 Cerise Rd
Billings, MT 59101-7378
(406) 245-5002 ext 102
(406) 245-4889 (fax)
WWW: http://www.link-comm.com
MailTo:steve.strobel@link-comm.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Skipping binary files when "svn diff" old revisions with incorrect svn:mime-type properties

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Steve Strobel wrote on Thu, 18 Sep 2008 at 11:23 -0600:
> I am trying to generate a diff between two revisions with a command like
> 
>         svn diff svn://192.168.25.29/trunk@2 svn://192.168.25.29/trunk@232
> 
> Unfortunately some of the files are binary but for some reason did not get
> their svn:mime-type property set to application/octet-stream, which causes
> the diff to end up with a bunch of unreadable binary characters in it.  I
> would like diff to skip those files with a message like
> 
>         Cannot display: file marked as a binary type.
>         svn:mime-type = application/octet-stream
> 
> I hoped to accomplish this by retroactively setting the svn:mime-type
> property of each such file, so I added the following to the
> pre-revprop-change hook script (*.bat file under Windows with svnserve):
> 
>         IF "%SVN_PROPNAME%" == "svn:mime-type" exit 0
> 

This script allows all revprop changes (since it never errors).

> I can now execute the propset command without getting an error message:
> 
>         svn propset --revprop -r 6 svn:mime-type application/octet-stream
> svn://192.168.25.29/trunk/vendors/AnalogDevices/RLC_DSP4/dsp4
>         property 'svn:mime-type' set on repository revision 6
> 
> but it doesn't seem to work.  The diff still has the same problem and
> proplist doesn't show the property:
> 
>         svn proplist
> svn://192.168.25.29/trunk/vendors/AnalogDevices/RLC_DSP4/dsp4
>         Properties on
> 'svn://192.168.25.29/trunk/vendors/AnalogDevices/RLC_DSP4/dsp4':
>           svn:executable
> 
> I am guessing that I can't change the properties retroactively like that for
> anything except svn:date, svn:author and svn:log because they are versioned
> and versions are immutable.

Yes and no.  svn:date et al are only special as revprops, and
svn:mime-type et al are only special as versioned props.  But as you
discovered, this isn't hard-coded to their names; you can create
a versioned prop svn:date and a revprop svn:mime-type.

You can also create your own props and revprops (with arbitrary names).

> As an aside, I think propset should give an
> error message when it is unable to do what you ask.

It did what you asked it to do: to set a *revprop* svn:mime-type.  (I'm
not saying that improvements aren't possible -- make it warn, or improve
the docs -- only that it *could* do (and in fact did) what you asked.)

> I could add the
> property to the binary files in a working copy and commit them, but I don't
> think that is going to help me diff the older revisions (some of those files
> might not even exist in the working copy on head).  Is there another way to
> get a diff without the binary files mucking it up?
> 
> Thanks for any suggestions,
> 
> Steve
> 
> 
> ---
> Steve Strobel
> Link Communications, Inc.
> 1035 Cerise Rd
> Billings, MT 59101-7378
> (406) 245-5002 ext 102
> (406) 245-4889 (fax)
> WWW: http://www.link-comm.com
> MailTo:steve.strobel@link-comm.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org