The use of SVN keywords

The version control system Subversion offers a nice feature called keywords. Keywords are a mechanism which allows to replace certain markers/placeholders in versioned text files with SVN metadata (author, last modified date, last modified revision, etc.). By default, keywords are disabled and may be activated with a specific SVN property called svn:keywords.  The corresponding chapter in the SVN book lists the available Keywords.

Keywords (in the example, the last modified date and revision) may either be activated for a single file:

or for a whole directory tree

As of the next commit of the files, all occurrences of $Date$ and $Revision$ placeholders will be updated with the up-to-date metadata every time you commit the file:

If you want to disable all keywords for a file/tree you use the propdel command:

For disabling certain keywords there exists the propedit command which fires up a text editor:

Note that propedit only works for a single file/directory and has, by nature, no recursive option. A recursive alternative is to use propset svn:keywords -R with a new list of SVN keywords.

The following is a list of my favorite keywords:

Keyword| Placeholder| Example
Date $Date$ $Date: 2013-05-01 10:08:40 +0200 (Wed, 01 May 2013) $
Revision $Revision$ $Revision: 11 $
Author $Author$ $Revision: svenlogan $

Links

  • [1] SVN Keyword Substitution (Svnbook)

Leave a Reply

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

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box