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

Re: Patches for better behavior, when adding binary files?

From: Ryan Schmidt <subversion-2007a_at_ryandesign.com>
Date: 2007-01-23 21:37:56 CET

On Jan 23, 2007, at 10:40, Rudolf Cejka wrote:

> I like to setup Subversion, so that all text files have svn:eol-
> style
> and svn:keywords set, but binary files does not have any of them.
> Currently,
> Subversion 1.4.2 (known to me since 1.2.0) does not include svn:eol-
> style
> for binary files, but why it does include svn:keywords? I think that
> svn:keywords is very similar to svn:eol-style in that it modifies
> checkouted files, which is bad for binary files.

Keywords are not bad for all binary files. For example, it's
conceivable that you might want to have Subversion keyword
substitution in a Word file or in a PDF, especially using the fixed-
width keyword expansion. Unfortunately, Subversion does not
distinguish between binary files which are images and binary files
which are text, so it does not know where it is safe to apply the
keywords and where it isn't. Therefore, it is up to you to properly
configure your auto-props so that images and other files where
keyword expansion is inappropriate do not receive the svn:keywords

I had thought that svn:eol-style was the same way. It's interesting
to see that Subversion already knows not to add it to binary files. I
don't think that used to be that way, but I can't find a record in
the issue tracker that anything like this was changed in recent
versions of Subversion.

> Current Subversion 1.4.2 behavior with added enable-auto-props = yes
> and * = svn:eol-style=native;svn:keywords="Date Revision Author
> HeadURL Id"
> in ~/.subversion/config:

Note that your svn:keywords specification is not correct: you need to
omit the quotes:

* = svn:eol-style=native;svn:keywords=Date Revision Author HeadURL Id

Otherwise the first and last keyword will not work (because
Subversion thinks the quotation mark is part of the keyword name and
therefore doesn't recognize it).

> $ svn add file.gif file.txt
> svn: File 'file.gif' has binary mime type property

Then you must also have something like

*.gif = svn:mime-type=image/gif

in your ~/.subversion/config. Without adding that, I do not get the
warning you got.

> # This is bad, because file.gif has been added without any
> indication.
> # It should either does not add file.gif as it did not add
> file.txt, or
> # it should furthermore write "A file.gif".

I agree that this situation is confusing. Subversion printed a
message that the file has a binary MIME type. Indeed it does. So
what? If Subversion is trying to tell us that *because* the file has
a binary MIME type it thinks you should not apply svn:keywords, then
*that* is what the message should say. It should also, as Rudolf
says, either not add the file (if Subversion thinks this is a fatal
error), or it should show that it added the file, and also proceed to
add the rest of the files listed on the command line. I think a bug
should be submitted for this. Please include a link to this
discussion thread when you submit the bug.

> $ svn proplist file.gif file.txt
> Properties on 'file.gif':
> svn:mime-type
> svn:keywords
> svn: 'file.txt' is not under version control
> # There is svn:mime-type instead of svn:eol-style, but why is there
> # svn:keywords?

Not a bug. You asked for svn:keywords (by using an auto-props rule
matching "*") and Subversion gave it to you. As stated, keywords can
be useful in some binary files.

To reply to the mailing list, please use your mailer's Reply To All  
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Jan 23 21:38:36 2007

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.