我正在尝试使用subgit进行导入。只是一次性迁移。我的SVN结构包含:
我想将所有三个转换为git中的分支。我试过了:
proj=myproject; subgit import --svn-url <correctPath>/$proj --authors-file
~/authors --branches branches --branches branches/features
--branches hotfixes --tags tags $i
这似乎只是使用“修补程序”作为唯一导入的地方。 (我正在使用SubGit版本2.0.2('Patrick')构建#2731。)我也尝试过使用:
--branches "branches;branches/features;hotfixes"
但是那完全失败了(它可能正在寻找一个带有分号的目录)。
有关一次性导入的任何建议吗?
(注意,我看到了this related question。)
答案 0 :(得分:3)
您可以结合使用'configure'+'install'+'uninstall'命令。我想,您的存储库具有以下结构:
$ svn ls --depth infinity <SVN_URL>
branches/
branches/branch1/
branches/branch2/
branches/features/
branches/features/feature1/
branches/features/feature2/
hotfixes/
hotfixes/hotfix1/
hotfixes/hotfix2/
tags/
tags/tag1/
tags/tag2/
trunk/
然后执行以下操作。运行'configure'命令:
$ subgit configure --svn-url <SVN_URL> repo
将repo / subgit / config文件编辑到此存储库结构(或者您可以创建自己的refs / heads / namespace,唯一的要求是:不同类型的分支不应该相同;如果您需要 - 时间导入和refs / heads / *下的所有内容,您可以稍后用脚本重命名它们:
trunk = trunk:refs/heads/master
branches = branches/*:refs/heads/*
branches = branches/features/*:refs/heads/features/*
branches = hotfixes/*:refs/heads/hotfixes/*
tags = tags/*:refs/tags/*
shelves = shelves/*:refs/shelves/*
运行'install'命令:
$ subgit install repo
然后如果你从“repo”目录运行“git branch -a”,你会看到类似的东西:
$ git branch -a
branch1
branch2
features/feature1
features/feature2
hotfixes/hotfix1
hotfixes/hotfix2
* master
您可以选择运行'uninstall'命令暂时或永久禁用同步(--purge选项)
$ subgit uninstall [--purge] repo