How to default svn:keywords to enabled?

jacknad picture jacknad · Sep 8, 2011 · Viewed 7.6k times · Source

Is there a way to enable svn:keywords by default so that this property does not need to be turned on for each keyword every time a new source file is added?

Answer

Daniel Trebbien picture Daniel Trebbien · Sep 8, 2011

Yes, with Subversion auto properties: http://www.dcepler.net/post.cfm/subversion-auto-properties

Each entry of the [auto-props] section is a file glob followed by the Subversion properties to automatically apply whenever a file matching the glob is added. For example, if you want all CPP files to have a certain set of properties by default, then follow the instructions on http://www.dcepler.net/post.cfm/subversion-auto-properties and modify the following line according to your preferences:

*.cpp        = svn:eol-style=native; svn:keywords="Author Date Id Rev URL"; svn:mime-type=text/plain

Note that if you added files with svn add and subsequently enabled auto properties, the auto properties will not be applied to the added files. Auto properties are applied only to files that are added after auto properties are enabled.