Git-svn可用于大型分支存储库吗? [英] Can Git-svn be used on large, branched repositories?

查看:121
本文介绍了Git-svn可用于大型分支存储库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将Git用作SVN存储库的前端,以便能够使用Git的诸如简单分支,存储等很好的功能。



问题是SVN存储库非常大(8,000转),并包含大量的分支和标签(旧的和新的)。



这是一个接近标准的布局,带有包含获取,分支和标签指令。

由于最旧的分支和标签引用版本10,这意味着每个 svn fetch 从修订版本10读取整个存储库历史记录并转发,这可能需要数小时才能完成。



如果我只跟踪主干,那很好,但我仍然想让git知道新的分支和标签。



我通常会看看 git log -1 on我在的分支并从评论中获得SVN修订版,所以我可以执行 git svn fetch -r7915:HEAD 或类似的操作。我想这就是 git svn fetch --parent 。但为什么我需要这样做呢?



我在Windows上,并使用TortoiseGit,它对 git-svn code>,但由于TortoiseGit只运行 git svn fetch 我有点卡住了。



Am我做错了什么?当第一个 svn clone -s 完成时,我期望 svn fetch 是一个快速操作。

解决方案

感谢您的回答。但是,它们并没有真正帮助我。



这个命令是迄今为止最好的解决方案:

 git svn log --all -1 | \ 
sed -n'2s / r \\([0-9] * \\)。* / \\1 / p'| \
xargs --replace = from git svn fetch -r from:HEAD

它使用 git svn log - -all 来查找到目前为止获取的最高SVN修订号,并从该点开始获取所有内容。



我希望 git svn fetch 将会有一个选项来表现这样的行为。除非SVN版本发生了变化,否则没有理由 git svn 应该每次都读取相同的版本。


I am trying to use Git as a frontend to a SVN repository in order to be able to use Git's nice features like simple branching, stashing etc.

The problem is that the SVN repository is quite large (8,000 revs) and contains lots of branches and tags (old as well as new).

It's a near standard layout, with a config containing fetch, branches and tags directives.

Since the oldest branch and tag refers to revision 10, it means that every svn fetch reads the entire repository history from revision 10 and forward, which can takes hours on the slow connection.

If I only track trunk, then it's fine, but I still want to make git aware of new branches and tags.

I usually look at git log -1 on the branch I'm at and gets the SVN revision from the comment, so I can do git svn fetch -r7915:HEAD or similar. I guess that's what git svn fetch --parent does. But why do I need to do this?

I'm on Windows, and use TortoiseGit which has quite nice support for git-svn, but since TortoiseGit only runs git svn fetch I'm kind of stuck.

Am I doing something wrong? I expect svn fetch to be a fast operation when the first svn clone -s is complete.

解决方案

Thanks for the answers. They did not really help me, though.

This command is the best solution so far:

git svn log --all -1 | \
  sed -n '2s/r\\([0-9]*\\).*/\\1/p' | \
  xargs --replace=from git svn fetch -r from:HEAD

It uses git svn log --all to find the highest SVN revision number fetched so far, and fetches everything from that point onwards.

I wish git svn fetch would have an option to behave like this. Unless the SVN revisions are changed, there is no reason git svn should fetch the same revisions over and over each time.

这篇关于Git-svn可用于大型分支存储库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆