Reputation: 891
I am keeping .xml files under svn. I would like to include svn info into comment section similar to c++: '// $Id$'
I tried '<!-- $Id$ -->'
it was not recognized by svn as a keyword. Please help.
Upvotes: 1
Views: 774
Reputation: 14940
The problem is not in the XML file (you can type the $Id$
keyword in any file).
But you have to tell Subversion that you want the keyword substitution on the particular file.
For example for the Id
and Author
keywords
svn propset svn:keywords 'Id Author' yourfile.xml
You can also instruct Subversion to enable the substitution with auto-props.
In your Subversion client config file (e.g., ~/.subversion/config
) in the [miscellany]
section, set enable-auto-props
to true.
And in the [auto-props]
section (probably need to create it) you can define the rules.
For example:
[miscellany]
enable-auto-props = true
[auto-props]
*.xml = svn:keywords=Id
Upvotes: 2
Reputation: 122414
<!-- $Id$ -->
is fine, the issue is that Subversion only replaces keywords in files that you've specifically tagged with the svn:keywords
property. If you do
svn propset svn:keywords Id file.xml
then it'll update the comment when you next commit.
To make this the default for all newly-added .xml
files you would need to edit the "auto-props" definitions in your subversion configuration, or (if you're on subversion 1.8.x or later) set the svn:auto-props
property on one of the ancestor directories up the tree. The Subversion book has the full details.
Upvotes: 0