<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Binary Files and Translation</title><link rel="stylesheet" href="styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="Version Control with Subversion" /><link rel="up" href="svn.forcvs.html" title="Appendix B. Subversion for CVS Users" /><link rel="prev" href="svn.forcvs.conflicts.html" title="Conflict Resolution" /><link rel="next" href="svn.forcvs.modules.html" title="Versioned Modules" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Binary Files and Translation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="svn.forcvs.conflicts.html">Prev</a> </td><th width="60%" align="center">Appendix B. Subversion for CVS Users</th><td width="20%" align="right"> <a accesskey="n" href="svn.forcvs.modules.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="svn.forcvs.binary-and-trans"></a>Binary Files and Translation</h2></div></div></div><p>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.</p><p>CVS users have to mark binary files with <code class="option">-kb</code> flags, to prevent data from being garbled (due to keyword expansion and line-ending translations). They sometimes forget to do this.</p><p>Subversion takes the more paranoid route—first, it never performs any kind of keyword or line-ending translation unless you explicitly ask it do so (see <a class="xref" href="svn.advanced.props.special.keywords.html" title="Keyword Substitution">the section called “Keyword Substitution”</a> and <a class="xref" href="svn.advanced.props.file-portability.html#svn.advanced.props.special.eol-style" title="End-of-Line Character Sequences">the section called “End-of-Line Character Sequences”</a> for more details). By default, Subversion treats all file data as literal byte strings, and files are always stored in the repository in an untranslated state.</p><p>Second, Subversion maintains an internal notion of whether a file is “<span class="quote">text</span>” or “<span class="quote">binary</span>” data, but this notion is <span class="emphasis"><em>only</em></span> extant in the working copy. During an <span class="command"><strong>svn update</strong></span>, Subversion will perform contextual merges on locally modified text files, but will not attempt to do so for binary files.</p><p>To determine whether a contextual merge is possible, Subversion examines the <code class="literal">svn:mime-type</code> property. If the file has no <code class="literal">svn:mime-type</code> property, or has a mime-type that is textual (e.g. <code class="literal">text/*</code>), Subversion assumes it is text. Otherwise, Subversion assumes the file is binary. Subversion also helps users by running a binary-detection algorithm in the <span class="command"><strong>svn import</strong></span> and <span class="command"><strong>svn add</strong></span> commands. These commands will make a good guess and then (possibly) set a binary <code class="literal">svn:mime-type</code> property on the file being added. (If Subversion guesses wrong, the user can always remove or hand-edit the property.)</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="svn.forcvs.conflicts.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="svn.forcvs.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="svn.forcvs.modules.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Conflict Resolution </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Versioned Modules</td></tr></table></div></body></html>