7

I'm maintaining a SVN server and on user needs to commit many adobe illustrator files (ie *.ai). I can use the auto-props in their config to set it as a binary file so that it won't be in the mailing list commits. However I'd like to make this as easy as possible. Is there something I can set in the SVN server config, so that it (ie the server) will automatically set the correct svn:mime-type?

Amandasaurus
  • 33,461

3 Answers3

6

It's not possible. There is a long standing feature request for broadcasting configs to client. It's not presently due until 2.0, or later.

The closest you can come is to use hooks. Either with a pre-commit to prevent incorrectly configured clients from submitting the wrong data. Or a post-commit to retro-fix wrong data.

Neither is great and I believe the latter is even advised against.

Dan Carley
  • 26,127
6

Apache Subversion 1.8 introduced the Repository Dictated Configuration feature which requires SVN 1.8 client. (1.8 server is not required, in other words).

With Subversion 1.8, you can configure auto-props patterns within a repository using the new Subversion svn:auto-props inherited property.

For example, setting svn:auto-props value to *.bmp = svn:mime-type=image/bmp property on the root of your repository (or repository path that represents a root of a project) will result into each newly added bitmap file to have the MIME type applied automatically.

You can store multi-line values in Subversion properties, so you can add the following (quite standard) svn:needs-lock and MIME pattern to svn:auto-props:

*.bmp = svn:mime-type=image/bmp;svn:needs-lock=*
*.gif = svn:mime-type=image/gif;svn:needs-lock=*
*.ico = svn:mime-type=image/x-icon;svn:needs-lock=*
*.jpeg = svn:mime-type=image/jpeg;svn:needs-lock=*
*.jpg = svn:mime-type=image/jpeg;svn:needs-lock=*
*.png = svn:mime-type=image/png;svn:needs-lock=*
*.tif = svn:mime-type=image/tiff;svn:needs-lock=*
*.tiff = svn:mime-type=image/tiff;svn:needs-lock=*    
*.doc = svn:mime-type=application/msword;svn:needs-lock=*
*.jar = svn:mime-type=application/octet-stream;svn:needs-lock=*
*.odc = svn:mime-type=application/vnd.oasis.opendocument.chart;svn:needs-lock=*
*.odf = svn:mime-type=application/vnd.oasis.opendocument.formula;svn:needs-lock=*
*.odg = svn:mime-type=application/vnd.oasis.opendocument.graphics;svn:needs-lock=*
*.odi = svn:mime-type=application/vnd.oasis.opendocument.image;svn:needs-lock=*
*.odp = svn:mime-type=application/vnd.oasis.opendocument.presentation;svn:needs-lock=*
*.ods = svn:mime-type=application/vnd.oasis.opendocument.spreadsheet;svn:needs-lock=*
*.odt = svn:mime-type=application/vnd.oasis.opendocument.text;svn:needs-lock=*
*.pdf = svn:mime-type=application/pdf;svn:needs-lock=*
*.ppt = svn:mime-type=application/vnd.ms-powerpoint;svn:needs-lock=*
*.ser = svn:mime-type=application/octet-stream;svn:needs-lock=*
*.swf = svn:mime-type=application/x-shockwave-flash;svn:needs-lock=*
*.vsd = svn:mime-type=application/x-visio;svn:needs-lock=*
*.xls = svn:mime-type=application/vnd.ms-excel;svn:needs-lock=*
*.zip = svn:mime-type=application/zip;svn:needs-lock=*
bahrep
  • 706
3

While there is no great answer to this, you can use svn_apply_autoprops.py which I wrote to apply your standard auto-props to a working copy to bring all the files there into compliance.