有没有从 CVS 到 Git 的迁移工具?
我打算从 CVS 切换到 Git。 对于 SVN,似乎有 cvs2svn
。 有没有类似的工具可以轻松地从 CVS 迁移到 Git?
I intend to switch over from CVS to Git.
In the case of SVN, there seems to be cvs2svn
. Is there a similar tool to easily migrate from CVS to Git?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
唯一具有增量导入功能的工具似乎是git-cvsimport。 如果你想从 CVS 转换(迁移)到 Git,目前最好的解决方案似乎是上面提到的 cvs2svn 的 cvs2git 模式。
另请参阅 Git wiki 上的 接口前端和工具 页面,部分关于与其他版本控制系统的交互。
The only tool that has incremental import seems to be git-cvsimport. If you want to convert (migrate) from CVS to Git, the best solution for now seems to be mentioned above cvs2git mode of cvs2svn.
See also Interfaces Frontends And Tools page on Git wiki, section about interaction with other revision control systems.
cvs2git
除了提供的答案之外,这里还有有关如何使用 cvs2git 工具将 cvs 转换为 git 的指南。 这里, modulename 是您要导入的 CVS 目录的名称。
先决条件
应该已经安装
cvs2svn
软件包(其中包括 cvs2git 命令)。更新:步骤 1 和 2 并不完全正确 - 在尝试之前,请阅读 cvs2git 维护者 mhagger 的下面的评论
checkout modulename
创建 cvs2git 所需的空 CVSROOT
在 http://cvs2svn.tigris.org/svn/cvs2svn/trunk/cvs2git-example.options(用户“guest”,无密码)
编辑cvs2git.options文件。 将 r'test-data/main-cvsrepos' 替换为 'modulename'。 编辑作者转换。
运行 cvs2git 创建 git 临时文件
创建 git 存储库
从 cvs2git 创建的 git 临时文件导入
签出工作副本
cvs2git
In addition to provided answers, here's a guide on how to convert cvs to git using cvs2git tool. Here, modulename is a name of CVS directory you want to import.
Prerequisites
cvs2svn
package (which includes cvs2git command) should be already installed.Update: steps 1 and 2 are not fully correct - before attempting, read the comment below by mhagger, the maintainer of cvs2git
checkout modulename
create an empty CVSROOT needed by cvs2git
download an example of cvs2git.options at http://cvs2svn.tigris.org/svn/cvs2svn/trunk/cvs2git-example.options (user "guest" with no password)
edit cvs2git.options file. Replace r'test-data/main-cvsrepos' with 'modulename'. Edit authors transforms.
run cvs2git to create git temp files
create git repository
import from git temp files created by cvs2git
checkout working copy
cvs2svn 有一个 cvs2git 模式。
cvs2svn has a cvs2git mode.
如果有人仍然不幸使用 CVS,你可以尝试“crap”:https://github.com/rcls/crap
它速度很快(就访问 CVS 而言可以很快),支持您在 cvs 存储库中发现的混乱情况,并且是增量的。
If anyone still has the misfortune of using CVS, you could try "crap" : https://github.com/rcls/crap
It's fast (as far as accessing CVS can be fast), supports the messes that you find in cvs repos, and incremental.
另一种方法可能是使用 git cvsimport *
An alternative might be to use git cvsimport *
我自己没有尝试过,但朋友们报告说我先从 CVS 转换到 SVN,然后从 SVN 转换到 Git,取得了很好的成功。 看起来,与直接从 CVS 到 Git 的转换相比,完成这些相应转换的工具已经被更彻底地淘汰了。
I've not tried this myself, but friends have reported good success converting first from CVS to SVN, and then from SVN to Git. It seems that the tools to do those respective transitions have been more thoroughly shaken out than a direct CVS to Git transition.
我是 cvs-fast-export 的维护者。 我曾经维护过 cvsps 和 parse2cvs,并且仔细评估了 cvs-fastimport 和 cvs2git。
CVS 到 git 的转换是一个棘手的、令人讨厌的问题,具有令人讨厌的边缘情况。 所有现有的转换工具都有已知的局限性,有些相当严重。
我建议首先尝试 cvs-fast-export。 它比其他任何东西都能产生更好、更快的转换,除非在极少数情况下它会彻底失败并退出。 如果您遇到罕见但可怕的“分支循环错误”,请尝试 cvs2git。
不要相信 cvs-fastimport,它有很多错误,并且经常搞砸分支连接。
有关详细信息,请参阅 http://www.catb.org/esr/cvs-fast -导出/
I'm the maintainer of cvs-fast-export. I used to maintain cvsps and parse2cvs and have closely evaluated cvs-fastimport and cvs2git.
CVS to git conversion is a hard, nasty problem with rebarbative edge cases. All the existing conversion tools have known limitations, some quite serious.
I recommend trying cvs-fast-export first. It produces better, faster conversions than anything else, except in rare cases where it fails cleanly and bails out. If you get the rare but dreaded "branch cycle error", try cvs2git.
Do not trust cvs-fastimport, it is quite buggy and often screws up branch joins.
For more, see http://www.catb.org/esr/cvs-fast-export/
我尝试过 cvs2git、git-cvsimport 和 parsecvs。
cvs2git 有时(据我记得)会为标签创建虚假分支。
git-cvsimport 不支持变更集的多个标签。 然而,可以对 cvsps 进行一些额外的更改来支持它,并将原始的 git-cvsimport 更改为使用更新的 cvsps 的内容(我已经尝试过,它似乎有效)。 从优点来看,它支持增量更新,并具有一些正确导入合并的逻辑(但它需要提交消息的适当格式)。
到目前为止,parsecvs 给了我最好的结果。 不幸的是,网络上可用的代码无法使用最新的 git 干净地编译。 这种改变虽然不是微不足道的,但却是可行的。
编辑:看起来ESR接管了cvsps 和 parsecvs 所以还有一些希望用于 CVS->GIT 迁移。 但他已经在一些邮件列表中提到,他可能会宣布他最近接管的一些工具正式死亡。
I've tried cvs2git, git-cvsimport and parsecvs.
cvs2git sometimes (as far as I remember) creates bogus branches for tags.
git-cvsimport does not support multiple tags for a changeset. It is possible however to grab some additional changes for cvsps to support it and change the original git-cvsimport to something which uses updated cvsps (I've tried it and it seems to work). On the advantage side it supports incremental updates and has some logic to properly import merges (but it REQUIRES appropriate format for commit message).
parsecvs so far gave me the best results. Unfortunately the code available on the web does not compile cleanly with the latest git. The change while not trivial is doable.
EDIT: It looks like ESR took over both cvsps and parsecvs so there is some hope for CVS->GIT migration. BUT he already mentioned on some mailing list that he may declare some of the tools he took over recently officially dead.
我阅读了 Vanuan 的答案和 mhagger 的评论。 不幸的是 mhagger 没有发布如何使用 cvs2git 来做到这一点。 这里写得很好: http://www.mcs.anl .gov/~jacob/cvs2svn/cvs2git.html
我使用了
cvs2git
而不是git-cvsimport
因为git-cvsimport
的文档> 建议改用它来避免 git-cvsimport 的问题: https://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.html#issues它遵循它的本质,适用于我从 Debian Sid 上的 sourceforge CVS 存储库创建 git 存储库:
需要 rsync 步骤,因为 cvs2git 需要访问整个历史记录。 简单的结帐是不够的。
I read the answer by Vanuan and mhagger's comments to it. Unfortunately mhagger didn't post how to do it with
cvs2git
. It is all very well written up here: http://www.mcs.anl.gov/~jacob/cvs2svn/cvs2git.htmlI used
cvs2git
instead ofgit-cvsimport
because the documentation ofgit-cvsimport
suggests to use it instead to avoid the problems ofgit-cvsimport
: https://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.html#issuesIt follows essence of it that worked for me to create a git repository from a sourceforge CVS repository on Debian Sid:
The
rsync
step is needed becausecvs2git
needs access to the whole history. A simple checkout is not enough.您可以将 fromcvs 添加到列表中。 它转换得很好,速度非常快,而且是增量的。 然而,它不做粘性标签,只做分支。
You can add fromcvs to the list. It converts well and is extremely fast and also incremental. It does not do sticky tags, only branches, however.
您可以使用 git cvsimport 。 它需要安装
cvsps
,但您需要安装2.x,因为3.x不兼容 不再了。然后在空 git 上导入 CVS 存储库。 示例用法:
在 OSX 上,您可以通过以下方式安装
cvsps-2.1
(使用brew
):您还可以使用
cvs2git
工具,可以将 CVS 存储库转换为 git。 但是您需要有权访问 CVSROOT 目录。检查 cvs2git 文档 了解安装步骤。
用法示例:
这将创建两个 git fast-import 格式的输出文件。 这些文件的名称由选项文件或命令行参数指定。 在示例中,这些文件名为
cvs2git-tmp/git-blob.dat
和cvs2git-tmp/git-dump.dat
。可以通过以下方式将这些文件导入到空的 git 存储库中:
然后删除 TAG.FIXUP 分支并运行 gitk --all 来查看转换结果。
通过运行:
cvs2git --help
检查更多信息。You can use
git cvsimport
. It requirescvsps
to be installed, but you need to install 2.x, as 3.x is not incompatible anymore.Then import CVS repository on empty git. Sample usage:
On OSX you install
cvsps-2.1
in the following way (havingbrew
):You can also use
cvs2git
tool which can convert a CVS repository to git. However you need to have access to a CVSROOT directory.Check cvs2git documentation for installation steps.
Example usage:
This would create two output files in git fast-import format. The names of these files are specified by your options file or command-line arguments. In the example, these files are named
cvs2git-tmp/git-blob.dat
andcvs2git-tmp/git-dump.dat
.These files can be imported into empty git repository by:
Then delete the
TAG.FIXUP
branch and rungitk --all
to view the results of the conversion.Check for more, by running:
cvs2git --help
.我发现 cvs-fast-export 做得非常出色。 我必须自己下载并编译它,但这样做没有遇到任何重大问题。
I found cvs-fast-export did an excellent job. I had to download and compile it myself, but didn't have any significant issues doing so.