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
  • 30,211
  • 62
  • 184
  • 246

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
  • 25,189
  • 5
  • 52
  • 70
  • 3
    It is possible with SVN 1.8 client. – bahrep Sep 02 '13 at 11:55
  • client != server side (as specified in question) – Jesse Aug 06 '15 at 18:17
  • @Jesse the repository-dictated configuration is a client-side feature. However, auto-props are set on the server/repository side and help push the config to clients. This answer is not actual anymore and is wrong. – bahrep Oct 27 '16 at 06:42
  • @bahrep The OP mentions auto-props and is aware of the auto-props functionality which is set, configured and modified **client side per repository**. For instance, if you manage hundreds or thousands of SVN repositories, then this configuration would have to be done **per repository** and isn't "easy" (per what the OP was looking for). This **per repository** configuration would also have to be explained to the owner of each repository and they could back-out the configuration if you don't prevent it with hooks. Dan's answer is correct given the original question. – Jesse Oct 27 '16 at 17:02
  • @Jesse There is client's side auto-props, and `svn:auto-props` which is server- or repository- side. In either case someone has to explain the owner or he has to read the documentation to implement any server or repository side feature. – bahrep Oct 28 '16 at 19:03
  • @bahrep Give me a configuration change that I can make to my server’s Subversion configuration file (i.e. subversion.conf) that will force all particular file extensions (i.e. *.ai) to be binary files for all Subversion repositories on the host. Pretty sure this is what “Is there something I can set in the SVN server config” means. – Jesse Oct 31 '16 at 18:53
  • @Jesse The stuff you look for is called "automation". You should apply `svn:auto-props` with the wanted values to your existing repositories. When you add a new repository, just add a step that will add the necessary `svn:auto-props`. – bahrep Oct 31 '16 at 18:57
  • @bahrep I'd suggest reading the OP's question again... "make this as easy as possible" != "apply svn:auto-props with the wanted values to your existing repositories. When you add a new repository, just add a step that will add the necessary svn:auto-props". This will be my last comment. Good luck to you. – Jesse Oct 31 '16 at 19:04
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
  • 664
  • 1
  • 9
  • 27
4

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.

Blair Zajac
  • 531
  • 5
  • 9
  • The link to svn_apply_autoprops.py seems to be broken. Searching for the filename gives me [this copy in Apache](http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svn_apply_autoprops.py) which is probably the same file. – Nikolaos Georgiou Aug 27 '12 at 10:46
  • Yes, that's the new location. The Subversion source code moved from svn.collab.net to svn.apache.org when we joined the Apache Software Foundation. – Blair Zajac Aug 28 '12 at 16:53
  • Don't think the script is actual after implementation of Repository Dictated Configuration: http://subversion.apache.org/docs/release-notes/1.8.html#repos-dictated-config – bahrep Sep 02 '13 at 11:56