Automatically add svn:needs-lock

Savvas Dalkitsis picture Savvas Dalkitsis · Apr 2, 2009 · Viewed 39.5k times · Source

Hi I was wondering if there is a way for the SVN server to automatically assign the svn:needs-lock property on any file that is binary and not textual.

We have a rather small developers team but resting on everyone to remember to set this property on newly created binary files doesn't make sense since it's very easy to forget such a thing.

Answer

bahrep picture bahrep · Sep 2, 2013

Apache Subversion 1.8 introduced the Repository Dictated Configuration feature which requires SVN 1.8 client, but 1.8 server is not necessary because this is a client-side feature.

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

For example, set svn:auto-props value to *.exe = svn:needs-lock=* property on the root of your repository (or repository path that represents a root of a project). This will result into each newly added *.exe file having svn:needs-lock=* property applied.

You can store multi-line values in Subversion properties, so you can add the following 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/x-msword;svn:needs-lock=*
*.docx = svn:mime-type=application/x-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=*