FYI: SVN and binary files (Was: Re: r16675 [2/4] ...)

2007-01-16 Thread christian . ridderstrom

On Tue, 16 Jan 2007, Georg Baum wrote:


[EMAIL PROTECTED] wrote:


I thought SVN treated all files as binaries?


No. It uses safer storage format than the diff based CVS format internally,
but from a users POV there is no difference.


Thanks for the clarification.

As a side note, the FAQ I copied below helped me fix a mysterious 
behaviour I've had with some PDF's in my work repository.


It turns out that some PDFs had not been tagged as binary files, so when 
browsing the repository (via WebDav/SVN) clicking on them didn't bring 
them up as PDFs. Instead you were just shown the raw content of the file.


Setting the mime type fixed this problem

thanks
/Christian

I found the FAQ enlightning, so I've copied it here in case it helps 
anyone else [ http://subversion.tigris.org/faq.html#binary-files ]:


How does Subversion handle binary files?

When you first add or import a file into Subversion, the file is examined 
to determine if it is a binary file. Currently, Subversion just looks at 
the first 1024 bytes of the file; if any of the bytes are zero, or if more 
than 15% are not ASCII printing characters, then Subversion calls the file 
binary. This heuristic might be improved in the future, however.


If Subversion determines that the file is binary, the file receives an 
svn:mime-type property set to application/octet-stream. (You can always 
override this by using the auto-props feature or by setting the property 
manually with svn propset.)


Subversion treats the following files as text:
* Files with no svn:mime-type
* Files with a svn:mime-type starting text/
* Files with a svn:mime-type equal to image/x-xbitmap
* Files with a svn:mime-type equal to image/x-xpixmap

All other files are treated as binary, meaning that Subversion will:
* Not attempt to automatically merge received changes with local changes
  during svn update or svn merge
* Not show the differences as part of svn diff
* Not show line-by-line attribution for svn blame

In all other respects, Subversion treats binary files the same as text 
files, e.g. if you set the svn:keywords or svn:eol-style properties, 
Subversion will perform keyword substitution or newline conversion on 
binary files.


Note that whether or not a file is binary does not affect the amount of 
repository space used to store changes to that file, nor does it affect 
the amount of traffic between client and server. For storage and 
transmission purposes, Subversion uses a diffing method that works equally 
well on binary and text files; this is completely unrelated to the diffing 
method used by the 'svn diff' command.



--
Christian Ridderström, +46-8-768 39 44   http://www.md.kth.se/~chr

FYI: SVN and binary files (Was: Re: r16675 [2/4] ...)

2007-01-16 Thread christian . ridderstrom

On Tue, 16 Jan 2007, Georg Baum wrote:


[EMAIL PROTECTED] wrote:


I thought SVN treated all files as binaries?


No. It uses safer storage format than the diff based CVS format internally,
but from a users POV there is no difference.


Thanks for the clarification.

As a side note, the FAQ I copied below helped me fix a mysterious 
behaviour I've had with some PDF's in my work repository.


It turns out that some PDFs had not been tagged as binary files, so when 
browsing the repository (via WebDav/SVN) clicking on them didn't bring 
them up as PDFs. Instead you were just shown the raw content of the file.


Setting the mime type fixed this problem

thanks
/Christian

I found the FAQ enlightning, so I've copied it here in case it helps 
anyone else [ http://subversion.tigris.org/faq.html#binary-files ]:


How does Subversion handle binary files?

When you first add or import a file into Subversion, the file is examined 
to determine if it is a binary file. Currently, Subversion just looks at 
the first 1024 bytes of the file; if any of the bytes are zero, or if more 
than 15% are not ASCII printing characters, then Subversion calls the file 
binary. This heuristic might be improved in the future, however.


If Subversion determines that the file is binary, the file receives an 
svn:mime-type property set to "application/octet-stream". (You can always 
override this by using the auto-props feature or by setting the property 
manually with svn propset.)


Subversion treats the following files as text:
* Files with no svn:mime-type
* Files with a svn:mime-type starting "text/"
* Files with a svn:mime-type equal to "image/x-xbitmap"
* Files with a svn:mime-type equal to "image/x-xpixmap"

All other files are treated as binary, meaning that Subversion will:
* Not attempt to automatically merge received changes with local changes
  during svn update or svn merge
* Not show the differences as part of svn diff
* Not show line-by-line attribution for svn blame

In all other respects, Subversion treats binary files the same as text 
files, e.g. if you set the svn:keywords or svn:eol-style properties, 
Subversion will perform keyword substitution or newline conversion on 
binary files.


Note that whether or not a file is binary does not affect the amount of 
repository space used to store changes to that file, nor does it affect 
the amount of traffic between client and server. For storage and 
transmission purposes, Subversion uses a diffing method that works equally 
well on binary and text files; this is completely unrelated to the diffing 
method used by the 'svn diff' command.



--
Christian Ridderström, +46-8-768 39 44   http://www.md.kth.se/~chr