将包含 Eclipse 项目的 CVS 存储库转换为 git 的最可靠方法?

发布于 2024-09-11 15:55:34 字数 2674 浏览 1 评论 0原文

我遇到的情况是,我有一个旧的 CVS 存储库,我们希望将其一次性转换为 git,同时保留完整的历史记录等。

存储库根目录下的所有文件夹都包含 Eclipse 项目(普通或动态 Web 项目),包括 .类路径和.project。我们使用 Team ProjectSets 来检查给定任务所需的项目(其中项目集位于包含 main 的项目中,其余的是库项目)。

检出团队项目集后,工作区已完全填充。

这种方法多年来一直运行良好(除了 3.5 附带的项目集部分),如果可能的话,我们希望以类似的方式使用 git,但我们不确定如何操作。

我玩过一些 git cvs import ,但它失败了 - 可能是因为我们没有使用模块。

您建议我们如何做到这一点?我们应该如何使用 git 来允许我们当前使用共享库项目?我们是否必须引入 Maven 并为我们的库项目创建 Maven 模块?或者只是蚂蚁常春藤?


编辑:我现在已经成功地使用合适的 cvs2svn 调用将我们的 CVS 存储库转换为 Subversion,并且发现 Eclipse 可以很好地识别生成的 Subversion 存储库。不幸的是,克隆 http://github.com/iteman/svn2git` 并尝试运行 bin/svn2git 之后我得到了

tra@Sandbox:~/cvsgit/svn2git/svn2git$ bin/svn2git
bin/svn2git:35:in `initialize': wrong number of arguments (2 for 1) (ArgumentError)
        from bin/svn2git:35:in `new'
        from bin/svn2git:35

This is with Ubuntu 10.04.1 LTS Server,我已经尝试了 Ruby 及其 gems 的各种 sudo 操作,但没有完全理解我所做的事情,因为我不是 Ruby 程序员,所以我可能把事情搞砸了一点。我希望得到建议 - 如果最简单的方法是安装另一个 Linux 变体来进行转换,那就没问题了。


编辑:

https://help.ubuntu.com/community/Git http://css.dzone.com/articles/subversion-git-morning


编辑:我使用默认 svn2git 的第一次尝试成功完成(一段时间后),我得到了一个不错的存储库,其中 gitbranch -a 大致报告

tra@Sandbox:~/gitroot/svnroot$ git branch -a
* master
  remotes/XX64_DEPLOYED_CODE
  remotes/Beta1
  remotes/Beta2
  remotes/SV46
  ... lots more

我们有兴趣能够检查 SV46 分支并使用它(我们基本上不关心标签,只关心实际的分支)。我已经设置了 gitosis 并将此存储库推送到 gitosis,并将其克隆到另一台计算机以了解如何使用 Eclipse 进行“使用 SV46”位。 那个存储库不知道所有分支:

tra@TRA ~/git/git00 (master)
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

我是否需要修改 svn2git 的原始结果才能将信息获取到 gitosis 存储库中?我需要带参数进行克隆吗?我应该使用建议的版本而不是 Ubuntu 附带的版本重做 svn2git 步骤吗?

编辑:事实证明,使用“git push --mirror”发布 svn2git 生成的存储库会使内容显示在 gitosis 存储库中。我现在在 gitosis 中看到以下内容(已修剪):

tra@Sandbox:/srv/gitosis/repositories/git01.git$ git branch -a
* master
  remotes/XX64_DEPLOYED_CODE
  remotes/Basic_Beta1
  remotes/Beta1
  remotes/Beta2
  remotes/SV46
  ... lots more
tra@Sandbox:/srv/gitosis/repositories/git01.git$ git branch
* master
tra@Sandbox:/srv/gitosis/repositories/git01.git$ git tag -l
tra@Sandbox:/srv/gitosis/repositories/git01.git$

尝试使用 git clone gitosis@sandbox:git01 -b remotes/SV46 或 git clone gitosis@sandbox:git01 -b SV46 克隆此存储库 都告诉我远程分支没有找到上游源,而是使用 HEAD。

我是不是找错了树?

I have a situation where I have an elderly CVS repository which we would like to convert to git once and for all while keeping full history etc.

All folders at the root of the repository contains Eclipse projects (either plain or dynamic web projects) including .classpath and .project. We use Team ProjectSets to check out the projects we need for a given task (where the project set is located in the project containing the main, and the rest are library projects).

When the Team ProjectSet is checked out, the workspace is fully populated.

This approach has worked pretty well for many years (except the project set part which came with 3.5), and we would like to work in a similar way with git if possible, but we are uncertain how.

I've played somewhat with git cvs import but it failed - probably due to us not using modules.

How would you suggest we do this, and how should we work with git to allow our current usage of shared library projects? Would we HAVE to introduce maven and create maven modules for our library projects? Or just ant ivy?


EDIT: I've now managed to convert our CVS repository to Subversion with a suitable cvs2svn invocation and found that Eclipse recognizes the resulting Subversion repository nicely. Unfortunately after cloning http://github.com/iteman/svn2git` and trying to run bin/svn2git I get

tra@Sandbox:~/cvsgit/svn2git/svn2git$ bin/svn2git
bin/svn2git:35:in `initialize': wrong number of arguments (2 for 1) (ArgumentError)
        from bin/svn2git:35:in `new'
        from bin/svn2git:35

This is with Ubuntu 10.04.1 LTS Server and I've tried various sudo things with Ruby and its gems without fully understanding what I did as I am not a Ruby programmer so I may have messed up things a bit. I'd appreciate advice - if the easiest is to install another Linux variant to do the conversion, that is fine.


EDIT:

https://help.ubuntu.com/community/Git
http://css.dzone.com/articles/subversion-git-morning


Edit: My first try with the default svn2git completed successfully (after a while), and I get a nice repository where git branch -a reports roughly

tra@Sandbox:~/gitroot/svnroot$ git branch -a
* master
  remotes/XX64_DEPLOYED_CODE
  remotes/Beta1
  remotes/Beta2
  remotes/SV46
  ... lots more

We are interested in being able to check out the SV46 branch and work with it (we basically do not care about the tags, just actual branches). I have set up gitosis and pushed this repository to gitosis, and cloned it to another computer to find out how to do the "work with SV46" bit with Eclipse. THAT repository does not know of all the branches:

tra@TRA ~/git/git00 (master)
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

Do I need to massage the original result from svn2git to get the information into the gitosis repository? Do I need to clone with an argument? Should I redo the svn2git step with the suggested version instead of the one shipping with Ubuntu?

EDIT: It turned out that publishing the svn2git generated repository with "git push --mirror" made things shown up in the gitosis repository. I now see the following inside gitosis (trimmed):

tra@Sandbox:/srv/gitosis/repositories/git01.git$ git branch -a
* master
  remotes/XX64_DEPLOYED_CODE
  remotes/Basic_Beta1
  remotes/Beta1
  remotes/Beta2
  remotes/SV46
  ... lots more
tra@Sandbox:/srv/gitosis/repositories/git01.git$ git branch
* master
tra@Sandbox:/srv/gitosis/repositories/git01.git$ git tag -l
tra@Sandbox:/srv/gitosis/repositories/git01.git$

Trying to clone this repository with git clone gitosis@sandbox:git01 -b remotes/SV46 or git clone gitosis@sandbox:git01 -b SV46 both tell me that the remote branch is not found upstream origin, using HEAD instead.

Am I barking up the wrong tree?

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

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

发布评论

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

评论(1

黑寡妇 2024-09-18 15:55:34

首先,对中央 VCS 存储库(即 CVS 存储库)的独立部分使用子模块总是好的(请参阅“Git 限制是什么?")。
这意味着您最终将得到许多独立的 Git 存储库,即“一组彼此独立发展的文件”,这就是子模块存在的原因。

因此需要多次 Git 导入(在多个存储库中)。

但由于 git cvs import 并不总是能够胜任这项任务,我建议:

  • cvs2svn 以便首先获得 SVN 存储库(仅一个存储库)
  • svn2git 以便将您的 SVN 存储库正确转换为git one(即将 SVN 分支转换为 Git 分支 SVN 标签转换为 Git 标签)

First of all, using submodules for independent parts of your Central VCS repository (i.e. your CVS repo) is always good (see "What are the Git limits?").
That mean you will end up with many independent Git repo, that is "set of files evolving independently one from another", which is why submodules exist.

So multiple Git import (in multiple repo) are required.

But since git cvs import is not always up to the task, I would recommend:

  • cvs2svn in order to get an SVN repo first (just one repo)
  • svn2git in order to properly convert your SVN repo to a git one (i.e. transforming SVN branches into Git branch and SVN tags into Git tags)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文