Background
我正在使用一个巨大的SVN存储库(完整克隆为~20Gb(,它具有以下顶级结构:
stuff
stuff/branches
stuff/tags
stuff/trunk
stuff/archive
stuff/build
stuff/machines
stuff/releases
第一点:我不知道[存档,机器,构建和发布]目录中包含什么东西,说实话 - 我真的不在乎 - 我只知道我不需要将它们存储在本地进行开发工作。
第二点:除了用于存储工件的愚蠢目录之外,从表面上看,这似乎是标准的SVN布局。但是,当您深入挖掘时,它会很奇怪,因为 trunk 目录包含多个项目,例如:
stuff/trunk/mars
stuff/trunk/earth
stuff/trunk/venus
stuff/trunk/saturn
stuff/trunk/pluto
...
分支文件夹的组织如下所述:
stuff/branches/<project>-<name of project branch>
其中每个分支都是从以下项目之一分支的:
stuff/trunk/<project>
我想实现什么目标?
我只想从冥王星项目(~20Mb(克隆东西。例如,在SVN中执行此操作时,我将发出以下命令:
svn checkout https://svn.example.com/svn/stuff/trunk/pluto
...
Checked out revision 3505
我的问题是我无法使用 git-svn 复制它。我已经尝试了无数次使用不同的选项来"git svn 克隆",每次我最终克隆整个存储库 (~20Gb( 或什么都没有。当然不应该这么难,所以我一定做错了什么。
如果我能够只克隆 pluto 项目,当我使用 git-svn 创建一个新分支时,我也希望它为我创建一个 SVN 分支,例如,我希望以下命令是等效的:
svn copy https://svn.example.com/svn/stuff/trunk/pluto
https://svn.example.com/svn/stuff/branches/pluto-1234
-m "Making branch pluto-1234 from /stuff/trunk/pluto"
git svn branch -m
"Making branch pluto-1234 from /stuff/trunk/pluto"
pluto-1234
以便在以下位置创建新的 SVN 分支:
stuff/branches/pluto-1234
git svn clone --trunk stuff/trunk/pluto --branches stuff/branches --include-paths='stuff/branches/pluto-.*'
pluto-.*
是用于选择所需分支的正则表达式。见 https://git-scm.com/docs/git-svn#Documentation/git-svn.txt---include-pathsltregexgt