SVN properties

SVN allows to store some useful keywords which can be set, the value of which will be substituted for ‘tags’ in the file itself.

For instance, if the Id keyword is set, place this line in your code

__revision__ = "$Id: gendoc.py 2252 2010-02-08 17:43:10Z username $"

The string between $Id: and $ is going to be automatically replaced in the future by the proper Date, SVN revision and author. This is especially useful when you want to associate a revision with an executable.

Yet, most of the time the properties are not set. One way to do it is manually:

svn propset svn:keywords "Author Date Id Rev URL"  example.py

If you already have a bunch of files, just use a linux tools such as find:

find . -name "*py" | xargs svn propset svn:keywords "Author Date Id Rev URL"

Finally, if you create a file, again you have to set the properties. Hopefully, there is a configuration options that will automatically set the properties to the new added/commited files. Change the configuration file in ~/.subversion/config:

enable-auto-props = yes
[auto-props]
*.c = svn:keywords=Author Date Id Rev URL;svn:eol-style=native
*.h = svn:keywords=Author Date Id Rev URL;svn:eol-style=native
*.cc = svn:keywords=Author Date Id Rev URL;svn:eol-style=native
*.cpp = svn:keywords=Author Date Id Rev URL;svn:eol-style=native
*.py = svn:keywords=Author Date Id Rev URL;svn:eol-style=native
Please follow and like us:
This entry was posted in Computer Science, Linux and tagged , . Bookmark the permalink.

5 Responses to SVN properties

Leave a Reply

Your email address will not be published. Required fields are marked *