cvs2svn更改源代码中的“日期"字符串 [英] cvs2svn changes 'date' string in source codes

查看:106
本文介绍了cvs2svn更改源代码中的“日期"字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我转换了我们小组的两个CVS存储库,并将它们加载到SVN中.但是我发现有些文件被更改了!!!

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

例如, 静态字符rcsid [] = "$ Revision:1.1.1.1 $$ Date:2007/06/25 16:56:59 $";

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

已更改为 静态字符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 $";

这些是实际的字符串,而不是注释. (一些其他更改的字符串在注释中,可以). 那么,为什么cvs2svn会这样做呢?以及如何防止cvs2svn这样做??? 我添加了--keywords-off选项,但这没什么不同.

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.

感谢您的帮助!

推荐答案

在签出文件时,CVS会将关键字(如$Date$)扩展到正确的值,而不是在签入文件时将其扩展到正确的值此外,不同版本的CVS以不同的样式扩展日期.在CVS 1.12之前,日期使用斜线(例如2007/06/25)进行了扩展.从CVS 1.12开始,日期已经用破折号扩展,例如2007-06-25.

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.

从Subversion检出文件时看到的日期格式是Subversion扩展关键字的结果. AFAIK Subversion始终以破折号将日期扩展为新样式.因此,字符串看起来不同的原因是Subversion使用了不同的日期扩展样式,而不是cvs2svn所做的任何事情.

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.

当您指定--keywords-off时,cvs2svn会保留关键字在CVS中的扩展状态,即在 in 中被检查时的形式.通常,这意味着它们采用的是上次 out 签入文件时的格式,即具有反映文件先前修订版本的值.这很少有用.

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.

获取所需格式的日期字符串的唯一方法是cvs2svn扩展日期字符串本身并关闭SVN关键字扩展 .另外,您必须配置cvs2svn以使用扩展的旧日期格式"进行扩展,可以通过调用_KeywordExpander.use_old_date_format()(或通过编辑文件cvs2svn_lib/keyword_expander.py来设置).但是,大概,您可能希望在转换后将关键字扩展重新打开,以便随后的Subversion修订版也对其关键字进行扩展.因此,在转换之后,您将必须在任何包含关键字的文件上设置svn:keywords属性,并且还必须手动重新折叠这些文件中的关键字(例如,将$Date: 2007/06/25 16:56:59 $重新编辑为$Date$).总而言之,这在配置上会非常棘手,并且可能不值得付出努力.

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.

这篇关于cvs2svn更改源代码中的“日期"字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆