简体   繁体   English

如何git svn只获取某些模式的分支/标签?

[英]How to git svn fetch only branches/tags with certain patterns?

I want to check out Boost library using git-svn, and I only want to checkout trunk and tags starting from version 1.35, ie tags/release/Boost_1_35 and up. 我想使用git-svn检查Boost库,我只想从版本1.35开始检查主干和标签,即标签/发布/ Boost_1_35及以上。 My config looks like this: 我的配置如下所示:

[svn-remote "svn"]
    ignore-paths = ^tags/release/(?i:(?!boost)|[^/]*(?:beta|rc)|boost_(?:0|1_[1-2]|1_3[0-4]))[^/]*/
    url = https://svn.boost.org/svn/boost
    fetch = trunk:refs/remotes/svn/trunk
    tags = tags/release/*:refs/remotes/svn/tags/*

However, git fetch still fetches tons of unrelated tags such as svn/tags/version_0-9-10 or svn/tags/version_0-9-10@44215. 但是,git fetch仍会获取大量不相关的标记,例如svn / tags / version_0-9-10或svn / tags / version_0-9-10 @ 44215。 I wonder what's the correct way of specifying ignore-paths to achieve this effect. 我想知道指定ignore-paths以实现此效果的正确方法是什么。

BTW: I've read How do I fetch/clone only a few branches using git-svn? 顺便说一句:我读过如何使用git-svn获取/克隆一些分支? but doesn't sounds a scalable solution. 但听起来不是一个可扩展的解决方案

I have managed to do so for certain branches, but since tags in svn are actually branches it should probably be the same: 我已经设法为某些分支机构这样做,但由于svn中的标签实际上是分支,它应该是相同的:

After git svn init with "-t tags and -b branches" I have edited .git/config to be: 在使用“-t tags和-b branches”的git svn init之后,我编辑了.git / config为:

[svn-remote "svn"]
        ... url, fetch and stuff ... 
        branches = branches/rel-2.1/*:refs/remotes/svn/branches/rel-2.1/*
        branches = branches/rel-2.2/*:refs/remotes/svn/branches/rel-2.2/*
        branches = branches/rel-2.3/*:refs/remotes/svn/branches/rel-2.3/*
        branches = branches/rel-2.4/*:refs/remotes/svn/branches/rel-2.4/*
        branches = branches/rel-2.5/*:refs/remotes/svn/branches/rel-2.5/*

I used a simple python code to generate the relevant lines and copied it to .git/config: 我使用一个简单的python代码生成相关的行并将其复制到.git / config:

for x in range(1,6):
   print branches = "     branches/rel-2.{0}/*:refs/remotes/svn/branches/rel-2.{0}/*".format(x)

Not as scalable as regex, but that's the best I could find. 不像正则表达式那样可扩展,但这是我能找到的最好的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM