cvs2svn changes 'date' string in source codes

六月ゝ 毕业季﹏ 提交于 2020-01-25 10:18:04

问题


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!


回答1:


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 (e.g., 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.



来源:https://stackoverflow.com/questions/45199649/cvs2svn-changes-date-string-in-source-codes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!