Git SVN 忽略路径如何工作(忽略每日构建标签)?
我正在尝试使用 git svn 克隆 svn 存储库。该存储库具有我想忽略的每日构建标记。我正在尝试使用“ignore-paths”选项来执行此操作,但我仍然将每日构建标签作为我的存储库中的分支。
最近有一个类似的(但到目前为止尚未得到解答)问题: 如何 git svn 仅获取分支/标签某些模式?
存储库布局 - https://test.kuali.org/svn/rice
通用存储库结构
- 分支
- 分支 1
- 忽略目录 1
- 忽略目录 1
- 标签
- 标签 1
- 标签 2
- 旧
- 旧标签 1
- 旧标签 2
- 构建
- 每日构建 1
- 每日构建 2
- trunk
我尝试过的内容
我不太擅长正则表达式,它们可能是错误的,但这是我尝试过的:
这只是我在中找到的内容的修改版本git svn 文档:
git svn clone -r15709:HEAD --prefix=svn/ --stdlayout --no-follow-parent --ignore-paths="^[^/]+/(?:tags/builds|tags/old|branches)" https://test.kuali.org/svn/rice
这是我试图简化的:
git svn clone -r15709:HEAD --prefix=svn/ --stdlayout --no-follow-parent --ignore-paths="(old|builds)" https://test.kuali.org/svn/rice rice-full
绝望...(并添加了一些我不需要的其他路径)
git svn clone -r15711:HEAD --prefix=svn/ --stdlayout --ignore-paths="^[^/]+/(?:builds|old)|inactive|rice-functional-tests|sandbox|tools" https://test.kuali.org/svn/rice
然后我切换到更新的版本,这样它会更快完成,并尝试忽略所有分支和标签测试。这个似乎没有得到任何分支和标签,但它也从未完成。它似乎冻结了(至少,它运行的时间比我想象的只获取一两天历史的时间要长):
git svn clone -r21846:HEAD --prefix=svn/ --stdlayout --ignore-paths="^tags*|^branches*" https://test.kuali.org/svn/rice
我尝试的最后一个是:
git svn clone -r15711:HEAD --prefix=svn/ --stdlayout --ignore-paths="^tags/old*|^tags/builds*|^inactive*|^rice-functional-tests*|^sandbox*|^tools*" https://test.kuali.org/svn/rice
一般想法和问题
我不确定到底是什么忽略路径正则表达式匹配。是svn仓库的相对路径(tags/builds/Daily build 1)吗?是针对项目中的每个文件(tags/builds/Daily build 1/file 1、tags/builds/Daily build 1/file 2)进行评估还是仅在分支/标签级别(tags/builds/Daily build 1)进行评估?是否包含存储库基本 url (https://test.kuali.org/ svn/rice/tags/builds/Daily build 1)?
除了 --stdlayout (为标签指定正则表达式以获得我想要的内容)之外,我还应该做些什么吗?
我只对主干和某些发布标签感兴趣。有更好的方法来获得这些吗?我尝试仅使用主干进行克隆,然后在配置中添加“fetch =”以仅添加我关心的标签,然后获取标记的修订版,但是当我在 git gui 中查看结果时(可视化所有分支) )这两个标签在一次提交中显示为浮动(不绑定到主干或彼此)。
不确定它是否相关,但我在 Windows 7 64 位机器上使用 msysgit (git 版本 1.7.3.1.msysgit.0)。
很长的问题,我知道......我只是想彻底。
I am trying clone an svn repository using git svn. The repository has daily builds tagged which I want to ignore. I am trying to use the "ignore-paths" option to do that, but I am still getting the daily build tags as branches in my repository.
A very recent and similar (but so far unanswered) question is here:
How to git svn fetch only branches/tags with certain patterns?
Repository Layout - https://test.kuali.org/svn/rice
General Repository Structure
- branches
- Branch 1
- Ignore Directory 1
- Ignore Directory 1
- tags
- Tag 1
- Tag 2
- old
- Old Tag 1
- Old Tag 2
- builds
- Daily build 1
- Daily build 2
- trunk
What I have Tried
I am not that great at regular expressions, and they might be wrong, but here is what I've tried:
This was just a modified version of something I found in the git svn documentation:
git svn clone -r15709:HEAD --prefix=svn/ --stdlayout --no-follow-parent --ignore-paths="^[^/]+/(?:tags/builds|tags/old|branches)" https://test.kuali.org/svn/rice
This was me trying to simplify:
git svn clone -r15709:HEAD --prefix=svn/ --stdlayout --no-follow-parent --ignore-paths="(old|builds)" https://test.kuali.org/svn/rice rice-full
Desperation... (and adding some other paths I didn't need)
git svn clone -r15711:HEAD --prefix=svn/ --stdlayout --ignore-paths="^[^/]+/(?:builds|old)|inactive|rice-functional-tests|sandbox|tools" https://test.kuali.org/svn/rice
Then I switched to a more recent revision so it would finish sooner and tried ignoring all branches and tags for a test. This one seemed not to get any branches and tags, but it also never finished. It seemed to freeze (at least, it ran longer than I thought it should have for only getting a day or two of history):
git svn clone -r21846:HEAD --prefix=svn/ --stdlayout --ignore-paths="^tags*|^branches*" https://test.kuali.org/svn/rice
The last one I tried was:
git svn clone -r15711:HEAD --prefix=svn/ --stdlayout --ignore-paths="^tags/old*|^tags/builds*|^inactive*|^rice-functional-tests*|^sandbox*|^tools*" https://test.kuali.org/svn/rice
General Thoughts and Questions
I'm not sure exactly what the ignore-paths regular expression is matching against. Is it the relative path of the svn repository (tags/builds/Daily build 1)? Is it evaluated for each file in the project (tags/builds/Daily build 1/file 1, tags/builds/Daily build 1/file 2) or just at the branch/tag level (tags/builds/Daily build 1)? Does it include the repository base url (https://test.kuali.org/svn/rice/tags/builds/Daily build 1)?
Is there something I should be doing other than --stdlayout (specifying a regular expression for the tags that would get what I want)?
I am only interested in trunk and certain release tags. Is there a better way to get those? I have tried cloning with only trunk, then adding a "fetch=" in the config to add only the tags I care about, then fetch the revision those were tagged from, but when I look at the result in git gui (visualize all branches) the two tags show up as floating with a single commit (not tied to trunk or each other).
Not sure if it is relavant, but I am using msysgit (git version 1.7.3.1.msysgit.0) on a windows 7 64 bit machine.
Long question, I know... I just wanted to be thorough.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅克隆主干而不做其他事情可能会更容易(
git svn clone -T http://path/to/ trunk
),然后通过修改配置文件并执行git svn fetch
es来添加您想要的特定标签和分支。It might be easier to just clone the trunk and nothing else (
git svn clone -T http://path/to/trunk
), and then add the specific tags and branches you want by modifying the config file and doinggit svn fetch
es.