【问题标题】:How can I git-cvsimport multiple modules from a CVS repository, with differing branches?如何从 CVS 存储库 git-cvsimport 多个具有不同分支的模块?
【发布时间】:2010-11-15 06:25:09
【问题描述】:

我正在尝试git-cvsimport CVS 中的几个不同模块,所有这些模块都位于不同的分支上。

到目前为止,我已经完成了这个(在伪 bash 代码中):

for each ($MODULE, $BRANCH); do
    git-cvsimport -p x -v -d "$CVS_REPO" "$MODULE" -o "$BRANCH" -C "$MODULE"
done

但这为每个模块创建了不同的 git 存储库。如果可能的话,我如何将它们全部合并为一个?

【问题讨论】:

    标签: git cvs version-control git-cvs


    【解决方案1】:

    我所做的是修改了 git-cvsimport perl 脚本,我将 update_index() 方法从:

    子更新索引(\@\@){ 我的 $old = 班次; 我的 $new = 班次; 打开(我的 $fh,'|-',qw(git update-index -z --index-info)) 或死“无法打开 git update-index: $!”; 打印 $fh (地图{“0 00000000000000000000000000000000000000000\t$_\0”} @$旧), (map { '100' . sprintf('%o', $_->[0]) . " $_->[1]\t$_->[2]\0" } @$新) 或死“无法写入 git update-index: $!”; 关闭 $fh 或死“无法写入 git update-index: $!”; 美元?并死“git update-index 报告错误:$?”; }

    收件人:

    子更新索引(\@\@){ 我的 $old = 班次; 我的 $new = 班次; 打开(我的 $fh,'|-',qw(git update-index -z --index-info)) 或死“无法打开 git update-index: $!”; 打印 $fh (地图{“0 0000000000000000000000000000000000000000\t$cvs_tree/$_\0”} @$旧), (map { '100' . sprintf('%o', $_->[0]) . " $_->[1]\t$cvs_tree/$_->[2]\0" } @$新) 或死“无法写入 git update-index: $!”; 关闭 $fh 或死“无法写入 git update-index: $!”; 美元?并死“git update-index 报告错误:$?”; }

    (注意添加了$cvs_tree 变量。)

    像魅力一样工作。执行:

    perl git-cvsimport -v ...(其余常规 git-cvsimport 参数)

    【讨论】:

    • 刚刚在 centos 5.5 上尝试了 1.7.5,但失败了。试过 perl /usr/local/libexec/git-core/git-cvsimport -v -d /root/cvs_mirror/java -C testdir -r cvs -k
    • 算了,我明白了:需要将完整路径添加到 repo 作为模块名称 - 从您的描述中不清楚:正确的命令行是 git cvsimport -v -d /path/to/repo -C testdir -r cvs -k /path/to/repo
    【解决方案2】:

    理论上,您可以使用 git grafts 将您的存储库合并为一个:
    "Is there a clean way to handle two original git repositories that started with the same content?"

    在实践中,您可能需要查看另一个工具,例如 cvs2git,并检查它是否没有以更一致的方式导入分支。

    【讨论】:

    • 它说您需要直接访问存储库才能使用 cvs2git。如果您只有远程访问权限,那显然是一种黑客攻击。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-20
    相关资源
    最近更新 更多