SVN Keywords substitution example

I use SVN as repository management tool and usually work on multiple projects simultaneously. I was looking for some way using SVN to generate a release notes file that can have version details. Then I got to know about SVN keywords substitution property and I used it to create a release notes for my project.

SVN Provides a list of keywords that you can set on a file and it will dynamically replace that with the latest information at the time of code check in. Some of these keywords are Id, Author, Revision, HeadURL etc.

So to create my release notes file, first of all I added a release.txt file at my project root directory with following information.


Notice the use of Id and HeadURL, these are the keywords that SVN will replace when I will check in this file. But before that we need to set the svn:keywords property on this file using below command.

Add all the keywords that you want to be replaced dynamically space separated, for example “Id HeadURL”.

Now after all my development for a version is finished, I check in this file and the file gets edited dynamically like this.

Now every time I just add additional information to the file with release notes data and I can figure out easily which is the last revision number for a version. For example my file looks like below at the time of check in.

Note that we need to remove the ending $ from keywords in the file else it will also get replaced.

That’s all about SVN keywords substitution example.

By admin

Leave a Reply

%d bloggers like this: