我正在使用git-svn来处理svn repo.我不想要整个回购,正弦它包含很多遗产,其中包含二进制文件.我只跟踪一些目录.
这是我的当前.git/config,这是正常的.
[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/*
现在我要添加一个新分支:
    branches = branches/{fuze_node}/:refs/remotes/*
但是当git svn fetchgit看不到新的分支时.它就好像该行不在配置中.
我知道这可以用一个新的svn-remote完成,但我宁愿不走那条路.
vad*_*hev 21
对于每个svn-remote git-svn,将最新获取的修订存储在.git/svn/.metadata文件中.它永远不会取得低于该值的修订.这就是为什么它不会获取你添加到配置中的分支; git-svn认为fuze_node分支已经转换.
但是,您可以获取此分支,而无需再次重新克隆整个存储库:
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/*
也就是说,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将只获取必要的修订.
| 归档时间: | 
 | 
| 查看次数: | 3026 次 | 
| 最近记录: |