<?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" type="text/css" href="styles.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <style type="text/css"> body { background-image: url('images/draft.png'); background-repeat: no-repeat; background-position: top left; /* The following properties make the watermark "fixed" on the page. */ /* I think that's just a bit too distracting for the reader... */ /* background-attachment: fixed; */ /* background-position: center center; */ }</style> <link rel="home" href="index.html" title="Version Control with Subversion [DRAFT]" /> <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 xmlns="" id="vcws-version-notice"> <p>This text is a work in progress—highly subject to change—and may not accurately describe any released version of the Apache™ Subversion® software. Bookmarking or otherwise referring others to this page is probably not such a smart idea. Please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a> for stable versions of this book.</p> </div> <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" title="Binary Files and Translation"> <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 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 to 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">“<span class="quote">text</span>”</span> or <span class="quote">“<span class="quote">binary</span>”</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> <div xmlns="" id="vcws-footer"> <hr /> <img src="images/cc-by.png" style="float: right;" /> <p>You are reading <em>Version Control with Subversion</em> (for Subversion 1.8), by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato.</p> <p>This work is licensed under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution License v2.0</a>.</p> <p>To submit comments, corrections, or other contributions to the text, please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a>.</p> </div> </body> </html>