Hi all,

I found today some interesting things regarding how SVN handles keyword expansion.

In order to do some merging between 2.1 and 2.2 on CForms code, I wrote a small shell script that replaces all expanded "$Id ....$" keywords by the unexpanded "$Id$" in order to use the nice Eclipse diffmerge GUI.

After running that script, I found that "svn status" reports that _some_ files have been modified, but not all. Some of the files reported as being modified still have an old CVS-style Id, and some have an SVN-style Id, but with a different file name (some files whose initial revision have been created by copying another existing file).

So I came to the conclusion that SVN is smart (too much maybe) and only replaces the content of an expanded keyword if this content matches some well-defined and strict pattern.

Examples:
- "$Id$" : ok, this is an unexpanded keyword
- "$Id: carselector_form.xml,v 1.1 2004/03/09 10:34:02 reinhard Exp $" : not ok, this is a CVS-style expansion
- "$Id: form1.xml 37200 2004-08-30 13:34:40Z cziegeler $" on the dynamicrepeater.xml file : not ok, file name doesn't match!!


The nice thing once all this has been fixed, is that SVN doesn't consider as being modified a file where expanded keyword have been replaced by their unexpanded counterpart. You can then use whatever diffmerge tool you want to sync 2.2 and 2.1, since only files having real differences (and not only a different $Id$) will show up in the tool.

Are other people interested in this small Id-unexpander script?

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to