简体   繁体   中英

cvs2svn changes 'date' string in source codes

I converted two of our group's CVS repositories and loaded them into SVN. But I found some files are changed !!!

for example, static char rcsid[] = "$Revision: 1.1.1.1 $$Date: 2007/06/25 16:56:59 $";

was changed to static char rcsid[] = "$Revision: 1.1.1.1 $$Date: 2007-06-25 16:56:59 $";

These are actual strings, not comments. (some other changed strings are in comments, which is OK). So why would cvs2svn would do that? and how to prevent from cvs2svn from doing it??? I added --keywords-off options, but that didn't make a difference.

Thanks for any help!

CVS expands keywords (like $Date$ ) to the right value when you check the file out, not (as you might guess) when you check the file in. Moreover, different versions of CVS expand dates in different styles. Prior to CVS 1.12, dates were expanded using slashes, like 2007/06/25 . Starting with CVS 1.12, dates have been expanded with dashes, like 2007-06-25 .

The date format that you are seeing when you check the file out of Subversion is the result of keyword expansion by Subversion. AFAIK Subversion always expands the dates in the new style, with dashes. So the reason that the strings look different is that Subversion uses a different date expansion style, not because of anything that cvs2svn does.

When you specify --keywords-off , then cvs2svn leaves the keywords expanded as they were in CVS, namely in the form they had when they were checked in . Usually that means that they are in the format they had when the previous time that the file was checked out , namely with the valued reflecting the previous revision of the file. This is rarely useful.

The only way to get the date strings in the format that you expected would be to have cvs2svn expand the date strings itself and turn SVN keyword expansion off . Plus you would have to configure cvs2svn to expand using the "old date format" for the expansion, which can be set by calling _KeywordExpander.use_old_date_format() (or by editing the file cvs2svn_lib/keyword_expander.py ). But then, presumably, you would want to turn keyword expansion back on post-conversion, so that subsequent Subversion revisions have their keywords expanded, too. So after the conversion, you would have to set the svn:keywords property on any file containing keywords, and you would also have to manually re-collapse the keywords (eg, edit $Date: 2007/06/25 16:56:59 $ back to $Date$ ) in those files. All in all, this would be quite tricky to configure and is probably not worth the effort.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM