简体   繁体   English

将项目从 RCS 迁移到 git?

[英]Migrate project from RCS to git?

I have a 20-year-old project that I would like to migrate from RCS to git, without losing the history.我有一个已有20 年历史的项目,我想从 RCS 迁移到 git,而不会丢失历史记录。 All web pages suggest that the One True Path is through CVS.所有网页都表明 One True Path 是通过 CVS。 But after an hour of Googling and trying different scripts, I have yet to find anything that successfully converts my RCS project tree to CVS.但是经过一个小时的谷歌搜索并尝试不同的脚本后,我还没有找到任何可以将我的 RCS 项目树成功转换为 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.我希望 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-export tool at http://git.oblomov.eu/rcs-fast-export was repaired on 14 April 2009, and this version seems to work for me.更新http : rcs-fast-export工具已于 2009 年 4 月 14 日修复,这个版本似乎对我有用。 This tool converts straight to git with no intermediate CVS.该工具无需中间 CVS 即可直接转换为 git。 Thanks Giuseppe and Jakub!!!感谢朱塞佩和雅库布!!!


Things that did not work that I still remember:我仍然记得的不起作用的事情:

  • The rcs-to-cvs script that ships in the contrib directory of the CVS sources CVS 源代码的contrib目录中附带的rcs-to-cvs脚本

  • The rcs-fast-export tool at http://git.oblomov.eu/rcs-fast-export in versions before 13 April 2010 2010 年 4 月 13 日之前版本的http://git.oblomov.eu/rcs-fast-export 上rcs-fast-export工具

  • The rcs2cvs script found in a document called "CVS-RCS- HOW-TO Document for Linux"在名为“CVS- rcs2cvs -HOW-TO Document for Linux”的文档中找到了rcs2cvs脚本

See InterfacesFrontendsAndTools page on Git Wiki, in "Tools", "Interaction with other Revision Control Systems", "Other".请参阅 Git Wiki 上的InterfacesFrontendsAndTools页面,在“工具”、“与其他修订控制系统的交互”、“其他”中。 There you would find a description and a link to rcs-fast-export ( gitweb ) Ruby script by Giuseppe "Oblomov" Bilotta.在那里您会找到 Giuseppe "Oblomov" Bilotta 的描述和指向rcs-fast-export ( gitweb ) Ruby 脚本的链接。

(Web search would find also Ohloh page and announcement for mentioned project) . (网络搜索也会找到 Ohloh 页面和上述项目的公告)

OK, after a little tinkering, I found it was trivial to convert RCS to CVS.好吧,经过一番修改后,我发现将 RCS 转换为 CVS 是微不足道的。 The files are in the same format, so it's simply a matter of moving the files into an existing CVS root.这些文件的格式相同,因此只需将文件移动到现有的 CVS 根目录中即可。 This assumes you have access to the RCS files.这假设您有权访问 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_

I had this problem too and wrestled with cvs2svn, parsecvs and whatnot.我也有这个问题,并与 cvs2svn、parsecvs 和诸如此类的东西搏斗。 parsecvs got the closest but Keith seems to have left it behind and now random forks are popping up. parsecvs是最接近的,但 Keith 似乎已经把它抛在了后面,现在随机分叉出现了。 The problem I struck with it was it would parse the RCS files just fine but the last thing it did was git rm the file, so I would have had to muck around with git reset to undo the deletion.我遇到的问题是它可以很好地解析 RCS 文件,但它做的最后一件事是git rm文件,所以我不得不使用git reset来撤消删除。

Then I discovered mercurial's convert : https://www.mercurial-scm.org/wiki/ConvertExtension Problem 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 树中逐步添加一些东西,它似乎奏效了。

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”需要是绝对路径。

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.快速浏览 rcs-fast-export.rb 截至 2011-01-12 并浏览了这部分代码。 This is scary at best.这充其量是可怕的。

# 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*(["'])?(.*)\1$/,       2],
            # the user's .(g)vimrc for a changelog_username setting
            ['~/.vimrc',  /changelog_username\s*=\s*(["'])?(.*)\1$/, 2],
            ['~/.gvimrc', /changelog_username\s*=\s*(["'])?(.*)\1$/, 2],
            []
    ].each do |fn, rx, idx|
...

Here I elaborate on Edward Falk's answer by trivially converting from RCS to CVS, then convert CVS to Git.在这里,我通过简单地从 RCS 转换为 CVS,然后将 CVS 转换为 Git 来详细说明 Edward Falk 的答案。 This example uses git-cvsimport to convert from CVS to Git, but any other CVS to Git conversion method should work.本示例使用git-cvsimport将 CVS 转换为 Git,但任何其他 CVS 到 Git 转换方法都应该有效。

mkdir $HOME/mydir/  # Any directory name will do.
cd $HOME/mydir/
cvs -d $HOME/mydir/ init

# Trivially import an RCS project into CVS.
cp -a /path/to/_projectname_/RCS $HOME/mydir/_projectname_

# Convert the CVS project to Git.
git cvsimport -d $HOME/mydir/ -C mynewgitrepository _projectname_

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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