Will Robertson
Will Robertson

Reputation: 64620

Why is $Id$ sometimes not expanded in SVN?

I'm working on a project in which we're actively using the $Id$ string generated by subversion to write the version number in the documentation. For example, we parse this string

$Id: filename 999 2009-02-23 22:51:29Z author $

and print "999" in the documentation titlepage.

But every now and then, after a commit, the information is removed and we're left with just

$Id$ 

This obviously breaks things a little. Does anyone know why it might be happening?


Okay, the obvious answer was correct; svn:keywords weren't set for that file any more. But I swear they used to be! Any idea how/why svn:keywords would have been cleared from a file without anyone noticing/doing anything on purpose?

Upvotes: 11

Views: 10287

Answers (5)

Maciej R
Maciej R

Reputation:

Make sure your file is in UTF-8 and NOT in Unicode. Unicode ones does not get expanded as SVN thinks these are not text files... I used Notepad Save As UTF-8 to solve the problem

Upvotes: 8

Bert Huijben
Bert Huijben

Reputation: 19622

Okay, the obvious answer was correct; svn:keywords weren't set for that file any more. But I swear they used to be! Any idea how/why svn:keywords would have been cleared from a file without anyone noticing/doing anything on purpose?

The first reason I can think of would be: If the file was svn-added and then moved/renamed before the first commit the auto properties weren't applied.

The bug that makes a file lose its properties in this case will be resolved in Subversion 1.5.6 and 1.6.0.

Upvotes: 0

Stewart Robinson
Stewart Robinson

Reputation: 3539

The answer you have selected is correct. You could additionally look at setting your auto-props to enable the keyword property automatically. See http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.4

When you've done that you could occasionally run svn_apply_autoprops.py from http://subversion.tigris.org/tools_contrib.html

svn_apply_autoprops.py will check your autoprops settings and go through your repository setting it all up.

Upvotes: 2

Ferdinand Beyer
Ferdinand Beyer

Reputation: 67177

Keywords are expanded on checkout only, if the 'svn:keywords' property is defined. When using repository browsing tools like ViewSVN, they should not be expanded, ie. they are displayed as $Id$.

Upvotes: 2

Sean Bright
Sean Bright

Reputation: 120704

The svn:keywords property may not be properly set on that file. You need to set it to (at least) 'Id':

svn ps svn:keywords 'Id' filename.txt

Upvotes: 12

Related Questions