二进制文件和行结束标记转换

In the most general sense, Subversion handles binary files more gracefully than CVS does. Because CVS uses RCS, it can only store successive full copies of a changing binary file. Subversion, however, expresses differences between files using a binary differencing algorithm, regardless of whether they contain textual or binary data. That means that all files are stored differentially (compressed) in the repository.

CVS users have to mark binary files with -kb flags in order to prevent data from being garbled (due to keyword expansion and line-ending translations). They sometimes forget to do this.

Subversion使用更加异想天开的方法—第一,如果你不明确的告诉它(详情见“关键字替换”一节“行结束字符串”一节)这样做,它不会做任何关键字或行结束转化的操作,缺省情况下Subversion会把所有的数据看作字节串,所有的储存在版本库的文件都处于未转化的状态。

第二,Subversion维护了一个内部的概念来区别一个文件是“文本”还是“二进制”文件,但这个概念在工作拷贝非常重要,在svn update,Subversion会对本地修改的文本文件执行上下文的合并,但是对二进制文件不会。

To determine whether a contextual merge is possible, Subversion examines the svn:mime-type property. If the file has no svn:mime-type property, or has a mime-type that is textual (e.g., text/*), Subversion assumes it is text. Otherwise, Subversion assumes the file is binary. Subversion also helps users by running a binary-detection algorithm in the svn import and svn add commands. These commands will make a good guess and then (possibly) set a binary svn:mime-type property on the file being added. (If Subversion guesses wrong, the user can always remove or hand-edit the property.)