将项目从 RCS 迁移到 git?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1619737/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:54:55  来源:igfitidea点击:

Migrate project from RCS to git?

gitmigrationcvsrcs

提问by Norman Ramsey

I have a 20-year-old projectthat I would like to migrate from RCS to git, without losing the history. All web pages suggest that the One True Path is through CVS. But after an hour of Googling and trying different scripts, I have yet to find anything that successfullyconverts my RCS project tree to CVS. I'm hoping the good people at Stackoverflow will know what actually works, as opposed to what is claimed to work and doesn't.

我有一个已有20 年历史的项目,我想从 RCS 迁移到 git,同时又不丢失历史记录。所有网页都表明 One True Path 是通过 CVS。但是经过一个小时的谷歌搜索并尝试不同的脚本后,我还没有找到任何可以将我的 RCS 项目树成功转换为 CVS 的东西。我希望 Stackoverflow 的好人会知道什么是实际有效的,而不是声称有效和无效的。

(I searched Stackoverflow using both the native SO search and a Google search, but if there's a helpful answer in the database, I missed it.)

(我使用原生 SO 搜索和 Google 搜索搜索了 Stackoverflow,但如果数据库中有有用的答案,我就错过了。)

UPDATE: The rcs-fast-exporttool at http://git.oblomov.eu/rcs-fast-exportwas repaired on 14 April 2009, and this version seems to work for me. This tool converts straightto git with no intermediate CVS. Thanks Giuseppe and Jakub!!!

更新http: //git.oblomov.eu/rcs-fast-export 上的rcs-fast-export工具已于 2009 年 4 月 14 日修复,这个版本似乎对我有用。该工具无需中间 CVS 即可直接转换为 git。感谢朱塞佩和雅库布!!!



Things that did not work that I still remember:

我仍然记得的不起作用的事情:

  • The rcs-to-cvsscript that ships in the contribdirectory of the CVS sources

  • The rcs-fast-exporttool at http://git.oblomov.eu/rcs-fast-exportin versions before 13 April 2010

  • The rcs2cvsscript found in a document called "CVS-RCS- HOW-TO Document for Linux"

  • CVS 源目录中rcs-to-cvs附带的脚本contrib

  • 2010 年 4 月 13 日之前版本rcs-fast-exporthttp://git.oblomov.eu/rcs-fast-export 上的工具

  • rcs2cvs在名为“CVS-RCS-HOW-TO Document for Linux”的文档中找到的脚本

采纳答案by Jakub Nar?bski

See InterfacesFrontendsAndToolspage on Git Wiki, in "Tools", "Interaction with other Revision Control Systems", "Other". There you would find a description and a link to rcs-fast-export(gitweb) Ruby script by Giuseppe "Oblomov" Bilotta.

请参阅Git Wiki 上的InterfacesFrontendsAndTools页面,在“工具”、“与其他修订控制系统的交互”、“其他”中。在那里,您会找到Giuseppe "Oblomov" Bilotta 的rcs-fast-export( gitweb) Ruby 脚本的描述和链接。

(Web search would find also Ohloh page and announcement for mentioned project).

(网络搜索也会找到 Ohloh 页面和上述项目的公告)

回答by Edward Falk

OK, after a little tinkering, I found it was trivial to convert RCS to CVS. The files are in the same format, so it's simply a matter of moving the files into an existing CVS root. This assumes you have access to the RCS files.

好吧,经过一番修改后,我发现将 RCS 转换为 CVS 是微不足道的。这些文件的格式相同,因此只需将文件移动到现有的 CVS 根目录中即可。这假设您有权访问 RCS 文件。

# Create CVS root dir. You only need to do this once.
mkdir $HOME/cvs/
cd $HOME/cvs/
cvs init

# Import a repository from RCS to CVS
cp -a _projectname_/RCS $HOME/cvs/_projectname_

回答by user317023

I had this problem too and wrestled with cvs2svn, parsecvs and whatnot. parsecvsgot the closest but Keith seems to have left it behind and now random forks are popping up. The problem I struck with it was it would parse the RCS files just fine but the last thing it did was git rmthe file, so I would have had to muck around with git resetto undo the deletion.

我也有这个问题,并与 cvs2svn、parsecvs 和诸如此类的东西搏斗。 parsecvs最接近,但 Keith 似乎已经把它抛在了后面,现在随机分叉出现了。我遇到的问题是它可以很好地解析 RCS 文件,但它做的最后一件事是git rm文件,所以我不得不git reset考虑撤销删除。

Then I discovered mercurial's convert: https://www.mercurial-scm.org/wiki/ConvertExtensionProblem solved!

然后我发现了 mercurial 的converthttps: //www.mercurial-scm.org/wiki/ConvertExtension问题解决了!

I tried to incrementally add some stuff from separate RCS trees, it seems to have worked.

我试图从单独的 RCS 树中逐步添加一些东西,它似乎奏效了。

回答by md0

As a general rule you should be careful as to what scripts you run. For RCS -> GIT it may be in your best interest to follow the RCS->CVS->GIT methodology.

作为一般规则,您应该小心您运行的脚本。对于 RCS -> GIT,遵循 RCS->CVS->GIT 方法可能符合您的最佳利益。

Took a quick look at rcs-fast-export.rb as of 2011-01-12 and ran across this portion of the code. This is scary at best.

快速浏览 rcs-fast-export.rb 截至 2011-01-12 并浏览了这部分代码。这充其量是可怕的。

# steal username/email data from other init files that may contain the
# information
def steal_username
    [
            # the user's .hgrc file for a username field
            ['~/.hgrc',   /^\s*username\s*=\s*(["'])?(.*)$/,       2],
            # the user's .(g)vimrc for a changelog_username setting
            ['~/.vimrc',  /changelog_username\s*=\s*(["'])?(.*)$/, 2],
            ['~/.gvimrc', /changelog_username\s*=\s*(["'])?(.*)$/, 2],
            []
    ].each do |fn, rx, idx|
...

回答by Jonas Berlin

Just found this, which worked fine for me:

刚刚发现这个,这对我来说很好用:

http://cynic.cc/blog/posts/migrate-from-rcs-to-git/

http://cynic.cc/blog/posts/migrate-from-rcs-to-git/

Just note that "cvs-source-dir" on that page needs to be a absolute path.

请注意,该页面上的“cvs-source-dir”需要是绝对路径。