If you forgot to set your svn:keywords…
Posted by danielmeyer on September 26, 2008
Somehow the Subversion auto-props didn’t cause my svn:keywords to automatically be set in my classes, and now I had 32 classes that, if I set the properties through Eclipse, I’d have to fix manually.
Me no like 32 repetitions of same thing.
So I looked for a way to do it from the command line.
Here’s a way that worked for me:
(I ran the following once from the project’s src/main/java, and once from src/test/java)
svn propset -R svn:keywords "Author Id Revision Date" .
Part of why this works so easily is that, guided by the Maven defaults, we’re set up with our Java source code split out from the other files into src/{main,test}/java. If the XML configuration files were in the same directory with Java source code, it would take more work to set the property on just the Java files, I think.
Update 10/10/2008: Ben (“New Ben”, I mean) helped me find two good things!
Why auto-props weren’t working
Even though I had the line
*.java = svn:keywords=Author Id Revision Date
in the [auto-props] section of my Subversion config (C:\Documents and Settings\myUserName\Application Data\Subversion\config), it wasn’t adding those keywords on commit.
It turns out there was one additional thing to do: in the [miscellany] section of the same config file, I needed to uncomment the line that reads:
enable-auto-props = yes
Ha!
Mass Keyword-Adding Using Eclipse
The other thing Ben showed me was how to recursively set the keywords from within Eclipse.
- Right-click on the source folder (src/main/java, for instance) and choose Team -> Set Property…
- For Property name, enter
svn:keywords(a warning appears at this point, but we will satisfy it soon) - In the “Enter a text property” box, enter (in my case)
Author Id Revision Date - Check the Set property recursively box
- Click OK.
I then repeated this procedure on the src/test/java folder.
Thanks, Ben!

T. Brandt said
Thanks a lot!
Your article saved me a lot of time ;)
danielmeyer said
Glad to hear it!