Subversion Keywords Expansion

1 Nov
2007

By default the keywords expansion in Subversion is disabled. To enable this feature you’ll have to update the Subversion configuration file. In Windows operating system this file is located under the C:\Documents and Settings\[username]\Application Data\Subversion\config folder, where [username] is your login username.

Ok, now to enable it, find a property called enable-auto-prop in the [miscellany] section and remove the remark, or if it doesn’t exist you can create one as the example below:

[miscellany]
enabe-auto-prop = yes

In the [auto-props] section you can declare the file to which the keywords expansion will be enabled. To create it see the following example for .java and .html files.

[auto-props]
*.java = svn:keywords=Id Author Date Revision HeadURL
*.html = svn:keywords=Id Author Date Revision HeadURL

Here is an example of a Java class with the SVN keywords in it.

/*
 * $Id:$
 * --------------------------------------------------------
 * Copyright (c) 2007 Kode Java Org.
 */
package org.kodejava.example.intro;

import java.util.Date;

/**
 * @author  I Wayan Saryada
 * @version $Revision:$
 */
public class HelloWorld {
    public static void main(String[] args) {
    }
}

From this point, everytime you add a Java or HTML document into your Subversion repository it will automatically have the keywords specified above expanded.

Comment Form

top