将 git 与 CVS 结合使用的最佳实践
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/595106/
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
Best practices for using git with CVS
提问by skiphoppy
What are your best practices and tips for using git to interface with a CVS repository?
使用 git 与 CVS 存储库交互的最佳实践和技巧是什么?
采纳答案by Brian Phillips
回答by Paul
I've only worked with Git-CVS interactions to demo Git for a friend, but it was very straightforward.
我只使用 Git-CVS 交互来为朋友演示 Git,但这非常简单。
- You need to install a current copy of
cvsps
.Git cvsimport
uses this to access CVS history. We found that, for a large project, inital set-up was muchfaster by taking a full copy of the CVS repo onto your computer, and doing the
git cvsimport
locally:$ rsync rsync://yourprojecthost.com/cvsroot/yourproject/* $ mkdir myproject.git $ cd myproject.git $ git cvsimport -p -x -v -d :local:/path/to/cvsroot/yourproject
- 您需要安装
cvsps
.Git cvsimport
使用它来访问 CVS 历史记录。 我们发现,对于大型项目,通过将 CVS 存储库的完整副本放到您的计算机上并在本地执行以下操作,初始设置要快得多
git cvsimport
:$ rsync rsync://yourprojecthost.com/cvsroot/yourproject/* $ mkdir myproject.git $ cd myproject.git $ git cvsimport -p -x -v -d :local:/path/to/cvsroot/yourproject
Note that the -x after -p is very important. This passes -x to cvsps. For more information please see the cvsps man page.
请注意,-p 后的 -x 非常重要。这将 -x 传递给 cvsps。有关更多信息,请参阅cvsps 手册页。
回答by Kristopher Johnson
I wrote up the details of my own workflow for remote CVS, local Git
我写了我自己的远程 CVS、本地 Git 工作流程的细节
回答by cnst
If the upstream is 100% in CVS (e.g., OpenBSD, or many of its subprojects like mdocmlor ports-readmes), and especially if it's as rusty as the OpenBSD CVS tree is (e.g., occasionally even having history rewrite), I find it quite useful to simply commit the underlying CVS/{Entries,Repository,Root}
files directly into my git
repository.
如果上游在 CVS 中是 100%(例如,OpenBSD,或其许多子项目,如mdocml或ports- readmes),特别是如果它像 OpenBSD CVS 树一样生锈(例如,偶尔甚至有历史重写),我发现简单地将底层CVS/{Entries,Repository,Root}
文件直接提交到我的git
存储库中非常有用。
This makes it very easy to not have to have multiple independent workspaces, make it possible to checkout with git
on any machine, and then cvs up
in place, or cvs diff
to generate correct CVS patches for mailing to the git-less maintainers upstream.
这使得不必拥有多个独立的工作区变得非常容易,可以git
在任何机器上签出,然后cvs up
就位,或者cvs diff
生成正确的 CVS 补丁以邮寄给上游的 git-less 维护者。
回答by Chris Huang-Leaver
Slightly meta-answer. If you are forced to use git 'guerilla style', i.e. your company is stuck using cvs for the version control and you use git on your workstation to make life easier, you might consider doing something like this;
稍微元答案。如果您被迫使用 git 'guerilla style',即您的公司被困在使用 cvs 进行版本控制,而您在工作站上使用 git 使生活更轻松,您可能会考虑做这样的事情;
CVS=realCvsPath
# commit to the git first
if ($ARGV[0] && $ARGV[0] eq "commit")
{
system 'git commit -a';
}
# execute the appropriate cvs program
# ===================================
exec "$CVS", @ARGV
Calling this file 'cvs' and including it the path before the real CVS command. Otherwise you can have git commits older than the cvs ones, which isn't that useful...
调用这个文件 'cvs' 并将其包含在真正的 CVS 命令之前的路径中。否则你可以让 git commits 比 cvs 更早,这不是那么有用......