<p>How do I tell Subversion (svn) to treat a file as a binary file?</p>

[{'answer_id': 73820, 'author': 'Jan Krüger', 'author_id': 12471, 'author_profile': 'https://Stackoverflow.com/users/12471', 'pm_score': 3, 'selected': False, 'text': '<p>For example:</p>\n\n<pre><code>svn propset svn:mime-type image/png foo.png\n</code></pre>\n'}, {'answer_id': 73830, 'author': 'Adrian Petrescu', 'author_id': 12171, 'author_profile': 'https://Stackoverflow.com/users/12171', 'pm_score': 2, 'selected': False, 'text': '<p>As per the <a href="http://subversion.apache.org/faq.html#binary-files" rel="nofollow noreferrer">Subversion FAQ</a>, you can use svn propset to change the <strong>svn:mime-type</strong> property to <strong>application/octet-stream</strong></p>\n'}, {'answer_id': 73832, 'author': 'Paul Dixon', 'author_id': 6521, 'author_profile': 'https://Stackoverflow.com/users/6521', 'pm_score': 2, 'selected': False, 'text': '<p>svn looks for a mime-type property, guessing it is text if it doesn\'t exist. You can explicity set this property, see <a href="http://svnbook.red-bean.com/en/1.5/svn.forcvs.binary-and-trans.html" rel="nofollow noreferrer">http://svnbook.red-bean.com/en/1.5/svn.forcvs.binary-and-trans.html</a></p>\n'}, {'answer_id': 73834, 'author': 'KTamas', 'author_id': 6541, 'author_profile': 'https://Stackoverflow.com/users/6541', 'pm_score': 4, 'selected': False, 'text': '<p>Basically, you have to set the mime type to octet-stream:</p>\n\n<pre><code>svn propset svn:mime-type application/octet-stream &lt;filename&gt;\n</code></pre>\n'}, {'answer_id': 73852, 'author': 'Frank Wiles', 'author_id': 12568, 'author_profile': 'https://Stackoverflow.com/users/12568', 'pm_score': 0, 'selected': False, 'text': "<p>It usually does this by default for you, but if it isn't you need to look into file properties and propset.  </p>\n"}, {'answer_id': 73863, 'author': 'Evil Andy', 'author_id': 4431, 'author_profile': 'https://Stackoverflow.com/users/4431', 'pm_score': 4, 'selected': False, 'text': '<p>From page 367 of the <a href="http://svnbook.red-bean.com/en/1.5/svn-book.pdf" rel="noreferrer">Subversion book</a></p>\n\n<blockquote>\n  <p>In the most general sense, Subversion handles binary files more gracefully than CVS does.\n  Because CVS uses RCS, it can only store successive full copies of a changing binary file.\n  Subversion, however, expresses differences between files using a binary differencing algorithm,\n  regardless of whether they contain textual or binary data. That means all files are\n  stored differentially (compressed) in the repository.</p>\n  \n  <p>CVS users have to mark binary files with -kb flags to prevent data from being garbled (due\n  to keyword expansion and line-ending translations). They sometimes forget to do this.</p>\n  \n  <p>Subversion takes the more paranoid route. First, it never performs any kind of keyword or\n  line-ending translation unless you explicitly ask it to do so (see the section called “Keyword\n  Substitution” and the section called “End-of-Line Character Sequences” for more details).\n  By default, Subversion treats all file data as literal byte strings, and files are always stored\n  in the repository in an untranslated state.</p>\n  \n  <p>Second, Subversion maintains an internal notion of whether a file is “text” or “binary” data,\n  but this notion is only extant in the working copy. During an svn update, Subversion will\n  perform contextual merges on locally modified text files, but will not attempt to do so for\n  binary files.</p>\n  \n  <p>To determine whether a contextual merge is possible, Subversion examines the\n  svn:mime-type property. If the file has no svn:mime-type property, or has a MIME\n  type that is textual (e.g., text/*), Subversion assumes it is text. Otherwise, Subversion\n  assumes the file is binary. Subversion also helps users by running a binary-detection algorithm\n  in the svn import and svn add commands. These commands will make a good\n  guess and then (possibly) set a binary svn:mime-type property on the file being added.\n  (If Subversion guesses wrong, the user can always remove or hand-edit the property.)</p>\n</blockquote>\n\n<p>Hand editing would be done by</p>\n\n<pre><code>svn propset svn:mime-type some/type filename.extension\n</code></pre>\n'}, {'answer_id': 73864, 'author': 'Brian R. Bondy', 'author_id': 3153, 'author_profile': 'https://Stackoverflow.com/users/3153', 'pm_score': 2, 'selected': False, 'text': '<p>If using tortoise svn in Windows, right click on the file and go to properties.  Click on new and add a new property of type svn:mime-type.  For the value put:  application/octet-stream</p>\n'}, {'answer_id': 73924, 'author': 'grammar31', 'author_id': 12815, 'author_profile': 'https://Stackoverflow.com/users/12815', 'pm_score': 2, 'selected': False, 'text': '<p>Although Subversion tries to <a href="http://subversion.apache.org/faq.html#binary-files" rel="nofollow noreferrer">automatically detect</a> whether a file is binary or not, you can override the mime-type using <a href="http://svnbook.red-bean.com/en/1.0/re23.html" rel="nofollow noreferrer">svn propset</a>.\nFor example, <code>svn propset svn:mime-type application/octet-stream example.txt</code>. This will make your file act as a collection of bytes rather than a text file. See also, the svn manual on <a href="http://svnbook.red-bean.com/nightly/en/svn.advanced.props.file-portability.html#svn.advanced.props.special.mime-type" rel="nofollow noreferrer">File Portability</a>.</p>\n'}, {'answer_id': 74017, 'author': 'stormlash', 'author_id': 12657, 'author_profile': 'https://Stackoverflow.com/users/12657', 'pm_score': 7, 'selected': True, 'text': '<p>It is possible to manually identify a file located within a repository as <em>binary</em> by using:</p>\n\n<pre><code>svn propset svn:mime-type application/octet-stream &lt;filename&gt;\n</code></pre>\n\n<p>This is generally not necessary, as Subversion will attempt to determine whether a file is binary when the file is first added.  If Subversion is incorrectly tagging a certain type as "text" when it should be treated as binary, it is possible to configure Subversion\'s <a href="http://svnbook.red-bean.com/nightly/en/svn.advanced.props.html#svn.advanced.props.auto" rel="noreferrer">auto-props feature</a> to automatically tag that file with a non-text MIME type.  Regardless of the properties configured on the file, Subversion still stores the file in a binary format within the repository.</p>\n\n<p>If Subversion identifies the MIME type as a "text" type, it enables certain features which are not available on binary files, such as <em>svn diff</em> and <em>svn blame</em>.  It also allows for automatic line ending conversion, which is configurable on a client-by-client basis.</p>\n\n<p>For more information, see <a href="http://subversion.apache.org/faq.html#binary-files" rel="noreferrer">How does Subversion handle binary files?</a></p>\n'}, {'answer_id': 11020623, 'author': 'user1454388', 'author_id': 1454388, 'author_profile': 'https://Stackoverflow.com/users/1454388', 'pm_score': 4, 'selected': False, 'text': "<p>If 'svn add' guesses the incorrect type and gives you an error like the following:</p>\n\n<pre><code>svn: E200009: File 'qt/examples/dialogs/configdialog/images/config.png' has inconsistent newlines\nsvn: E135000: Inconsistent line ending style\n</code></pre>\n\n<p>then the workaround is to add the file without properties and then set the properties in a second step:</p>\n\n<pre><code>svn add --no-auto-props qt/examples/dialogs/configdialog/images/config.png\nsvn propset svn:mime-type image/png qt/examples/dialogs/configdialog/images/config.png\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/73797', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5222/']