将 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

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

Best practices for using git with CVS

gitgit-cvs

提问by skiphoppy

What are your best practices and tips for using git to interface with a CVS repository?

使用 git 与 CVS 存储库交互的最佳实践和技巧是什么?

采纳答案by Brian Phillips

I wrote up an answer to a similar question here.

在这里写了一个类似问题的答案。

This works suprisingly well when you're forced to continue to push changes into a central CVS repository.

当您被迫继续将更改推送到中央 CVS 存储库时,这非常有效。

回答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 cvsimportuses 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 cvsimportlocally:

    $ 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 gitrepository.

如果上游在 CVS 中是 100%(例如,OpenBSD,或其许多子项目,如mdocmlports- 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 giton any machine, and then cvs upin place, or cvs diffto 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 更早,这不是那么有用......