将 git 与 CVS 结合使用的最佳实践

发布于 2024-07-14 03:15:18 字数 37 浏览 5 评论 0原文

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

无敌元气妹 2024-07-21 03:15:18

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

当您被迫继续将更改推送到中央 CVS 存储库时,这种方法的效果出奇地好。

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.

煮茶煮酒煮时光 2024-07-21 03:15:18

我只使用过 Git-CVS 交互来为朋友演示 Git,但它非常简单。

  • 您需要安装 cvspsGit 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  
      

注意 -p 之后的 -x 非常重要。 这会将 -x 传递给 cvsps。 有关详细信息,请参阅 cvsps 手册页

I've only worked with Git-CVS interactions to demo Git for a friend, but it was very straightforward.

  • 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 much faster 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 
    

Note that the -x after -p is very important. This passes -x to cvsps. For more information please see the cvsps man page.

如梦 2024-07-21 03:15:18

稍微元答案。 如果你被迫使用 git '游击风格',即你的公司一直使用 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

将此文件命名为“cvs”,并将其包含在真正的 CVS 命令之前的路径。 否则你可以让 git 提交早于 cvs 提交,这没那么有用......

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;

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

演多会厌 2024-07-21 03:15:18

如果上游 100% 采用 CVS(例如 OpenBSD 或其许多子项目,如 mdocmlports-readmes),特别是如果它像 OpenBSD CVS 树一样生锈(例如,有时甚至有历史重写),我发现将底层 CVS/{Entries,Repository,Root} 文件直接提交到我的 git 存储库非常有用。

这使得不必拥有多个独立工作区变得非常容易,可以在任何计算机上使用 git 签出,然后使用 cvs up 就位,或者 cvs diff 生成正确的 CVS 补丁,以便邮寄给上游无 git 的维护人员。

If the upstream is 100% in CVS (e.g., OpenBSD, or many of its subprojects like mdocml or 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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文