对于每个 svn-remote git-svn 存储最新获取的修订版 in .git/svn/.metadata
文件。它永远不会获取小于该值的修订。这就是为什么它不获取您添加到配置中的分支; git-svn 认为fuze_node
分支已经转换。
但是,您可以获取此分支,而无需再次重新克隆整个存储库:
- 添加另一个 svn-remote 以及您需要获取的所有分支;
- 删除旧的 svn-remote;
- Run
git svn fetch -R newer-svn-remote
从添加的分支中获取修订。
你的配置应该是这样的:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
# [svn-remote "svn"]
# url = https://svn.example.com/repository
# fetch = trunk/Python:refs/remotes/trunk
# branches = branches/{stage,prod,stage_with_proxy}/ucapi/:refs/remotes/*
# branches = branches/{active}/Python/:refs/remotes/*
[svn-remote "newer-svn-remote"]
url = https://svn.example.com/repository
fetch = trunk/Python:refs/remotes/trunk
branches = branches/{stage,prod,stage_with_proxy}/ucapi/:refs/remotes/*
branches = branches/{active}/Python/:refs/remotes/*
branches = branches/{fuze_node}/:refs/remotes/*
请注意,您必须指定与旧版 svn-remote 中完全相同的分支映射:
branches = branches/{stage,prod,stage_with_proxy}/ucapi/:refs/remotes/*
那是,参考/遥控器/*应该仍然位于映射的右侧。否则 git-svn 无法检测已转换的提交并尝试再次获取它们。
实际上还有另一种方法可以达到同样的效果。不过,它涉及对内部 git-svn 文件的一些操作。
您只需添加必要的分支即可.git/config
并更新.git/svn/.metadata
文件,所以最新获取的修订版变为0:
[svn-remote "svn"]
reposRoot = https://svn.example.com/repository
uuid = 8a6ef855-a4ab-4527-adea-27b4edd9acb6
branches-maxRev = 0
tags-maxRev = 0
在那之后git svn fetch
将仅获取必要的修订。