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?

3 Answers 3

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.

8
  • 3
    It is possible with SVN 1.8 client.
    – bahrep
    Sep 2, 2013 at 11:55
  • client != server side (as specified in question)
    – Jesse
    Aug 6, 2015 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, 2016 at 6: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, 2016 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, 2016 at 19:03
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=*
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.

3
  • The link to svn_apply_autoprops.py seems to be broken. Searching for the filename gives me this copy in Apache which is probably the same file. Aug 27, 2012 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. Aug 28, 2012 at 16:53
  • Don't think the script is actual after implementation of Repository Dictated Configuration: subversion.apache.org/docs/release-notes/…
    – bahrep
    Sep 2, 2013 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .