git - git svn clone 非标准存储库有问题
问题描述
背景
我正在使用一个巨大的 SVN 存储库(完整克隆约为 20Gb),它具有以下顶级结构:
stuff
stuff/branches
stuff/tags
stuff/trunk
stuff/archive
stuff/build
stuff/machines
stuff/releases
第一点:我不知道 [归档、机器、构建和发布] 目录中包含什么东西,老实说 - 我真的不在乎 - 我只知道我不需要将它们存储在本地来进行开发工作.
第二点:除了用于存储工件的愚蠢目录之外,从表面上看,这似乎是标准的 SVN 布局。但是,当您深入挖掘时,会发现它很奇怪,因为主干目录包含多个项目,例如:
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>
我想达到什么目的?
我只想从 pluto 项目(~20Mb)中克隆东西。例如,在 SVN 中执行此操作时,我会发出以下命令:
svn checkout https://svn.example.com/svn/stuff/trunk/pluto
...
Checked out revision 3505
我的问题是我无法使用 git-svn 复制它。我已经多次尝试使用不同的选项来“git svn clone”,每次我最终克隆整个 repo (~20Gb) 或什么都没有。当然它不应该这么困难,所以我一定做错了什么。
如果我能够 git-svn 仅克隆 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
推荐阅读
- ios - 如何使用 UICollectionViewCompositionalLayout 创建类似 instagram 配置文件的控制器?
- ios - 谷歌地图 SDK | iOS 11+ | 缩放地图时标记隐藏
- arrays - 在C中使用指针反转数组
- sql - SQL:如何从两个不同的查询中减去两个 SUM() 函数的结果
- cors - 使用 fetch 在启用通配符 CORS 的 gcs 存储桶上获取 CORS 问题
- python - 如何从具有多列的 CSV 中的字典列创建数据框?
- api - 用爪子设置 API 限制
- rest - Amqp 测试框架 - 无需编码即可编写测试
- python-3.x - 使用列表值排序字典(python)
- python-3.x - 如何在python中将多行文本文件作为数据框?