如何在Git中导入并保持更新CVS存储库? [英] How to import and keep updated a CVS repository in Git?
问题描述
CVS中有一个中央存储库,我想在本地使用它,然后将更改发送回CVS。
我能做些什么那每日的基础?
我想完成的任务是:
- 导入分支,
- 以类似GIT的格式获取历史记录,并且
- 将我的更改/提交导出到集中式服务器
顺便说一句,我也看过在CVS中使用git的最佳实践。但它不起作用,我无法弄清楚我错过了什么或错了什么。
我在做什么过去是:
导入CVS存储库
使用:
$ git cvsimport -C target-cvs -r cvs -k -vA authors-file.txt -d $ CVSROOT模块
$ b
其中:
-
target- cvs
是保存本地版本库的目录。 -
cvs
是要使用的名称用于引用远程存储库。因此,我将在本地指向的
,cvs / master cvs / HEAD
master 。 -
authors-file.txt
是包含CVS帐户和Name之间匹配的文件+ email,每行包含userid =用户名< useremail @ hostname>
-
$ CVSROOT
是CVS存储库服务器。如果我从某个sourceforge存储库使用匿名克隆,那么我会使用::pserver:anonymous@project_name.cvs.sourceforge.net:/ cvsroot / project_name
-
module
是我想要克隆的存储库中的模块。如果存储库只包含一个模块,则可能与project_name
相同。
更新存储库
可以重复我之前编写的命令。在那个例子中,它应该在 target-cvs
的父目录中运行。为了使将来更容易,您可能需要配置一些变量(您可以在)
$ b
$ git cvsimport
这足以让本地存储库保持在 git
与CVS中的远程仓库同步。
日常工作
从现在开始,每个变更都应该在本地git分支中进行。一个功能,一个分支。为此,我使用 一个成功的Git分支模型 。唯一的区别是, master 指向CVS,但概念上可以在这里应用相同的工作流程。这只是一个约定。
一旦您的提交被推入CVS,它将在下一次更新( git cvsimport
)。然后,您可以删除实现该功能的本地分支。
对于正在进行的工作(在本地分支机构中),您应该 rebase
他们反对主人。由于您的功能已分离,因此解决冲突应该更容易。棘手的部分是当一些分支依赖于其他分支,但仍然可以管理。微提交帮助很多(如在任何git工作流程中)。
如果每个本地分支都经过重新设计,并且主从未触及(除了更新),那么 git
应该可以工作。请记住,它适用于一次提交。这有点乏味,但总比没有好。鉴于前面的例子,这个命令应该是这样的:
cvsexportcommit
$ git cvsexportcommit -vc commit-id
如果您只有远程CVS的只读访问权限,那么您可以通过电子邮件发送修补程序或公开您的git存储库,所以委托人可以抓住你的补丁来应用它们。在这种情况下,与CVS的正常工作流程没什么不同。同样,在下一次更新中,您将看到 master 中的更改。
There is a central repository in CVS, and I would like to use it with Git locally, and then send my changes back to CVS.
What can I accomplish that on a daily basis?
The tasks I would like to accomplish are:
- importing branches,
- getting history in GIT-like format, and
- exporting back my changes/commits to the centralized server
BTW, I have also looked at Best practices for using git with CVS . But It didn't work and I couldn't figure out what I missed or did wrong.
What I have done in the past is:
Import the CVS repository
Using:
$ git cvsimport -C target-cvs -r cvs -k -vA authors-file.txt -d $CVSROOT module
Where:
target-cvs
is the directory to keep my local copy of the repository.cvs
is the name to use for referencing the remote repository. So, I will havecvs/master
,cvs/HEAD
, etc. pointed locally bymaster
.authors-file.txt
is the file that contains the matches between CVS account and Name+email, each line containsuserid=User Name <useremail@hostname>
$CVSROOT
is the CVS respository server. If I use an anonymous cloning from some sourceforge repository, then I would use::pserver:anonymous@project_name.cvs.sourceforge.net:/cvsroot/project_name
module
is the module inside of the repository I want to clone. If the repository has only one module, then likely will be the same asproject_name
.
Update the repository
It is possible to repeat the command I wrote previously. In that particular example, it should be run in the parent directory of target-cvs
. To make it easier in the future, you might want to configure some variables (you can read more details in the answer of "How to export revision history from mercurial or git to cvs?")
$ git cvsimport
That would be enough to keep the local repository in git
synchronized with the remote one in CVS.
Daily work
From now on, every change should go in a local git branch. One feature, one branch. For this, I use a work flow described in "A successful Git branching model". The only difference is that master points to CVS, but conceptually the same work flows can be applied here. It is just a convention.
Once your commit is pushed in CVS, it will be back to master in the next update (git cvsimport
). Then, you can remove the local branch that implemented that feature.
For work in progress (in local branches), you should rebase
them against master. Because you have the features separated, it should be easier to solve conflicts. The tricky part is when some branches depend on others, but still manageable. Micro commits helps a lot (as in any git work flow).
If every local branch is rebased and master never touched (except for updates), then git
cvsexportcommit
should just work. Remember, it works for one commit. It is a bit tedious, but it is better than nothing. Given the previous example the command should be something like:
$ git cvsexportcommit -vc commit-id
If you only have read-only access to the remote CVS, then you can send the patches by email or make your git repository public, so the commiters can grab your patches to apply them. Nothing different from a normal work flow of CVS in this case. Again, in the next update you will see the changes in master.
这篇关于如何在Git中导入并保持更新CVS存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!