恢复 git-svn 克隆

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2676912/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 08:17:06  来源:igfitidea点击:

Resuming git-svn clone

gitgit-svn

提问by Brandon Yarbrough

I started cloning an SVN repository using the git-svn's clone operation. After about 6 hours of importing (it's a big repo), my computer went and slept on me. Is there a way to resume the operation without redoing all of the initial work?

我开始使用 git-svn 的克隆操作克隆一个 SVN 存储库。经过大约 6 个小时的导入(这是一个很大的回购),我的电脑开始睡在我身上。有没有办法在不重做所有初始工作的情况下恢复操作?

回答by VonC

The git svn fetchcommand to resume a git svn cloneis confirmed by several sources:

git svn fetch恢复 a的命令git svn clone得到了几个来源的确认:

(Incidentally, if during the initial clone step your connection dies or you need to stop it then to resume the clone you just have to run the above command to resume downloading the history).

(顺便说一句,如果在最初的克隆步骤中您的连接中断或您需要停止它然后要恢复克隆,您只需运行上述命令以恢复下载历史记录)。

There seems to be a memory leak in git-svn. The size of the git-svnprocess grew slowly and after about two weeks it was at 1.2 GB resident size, at which point the OS refused to let it fork.
Thing is, this was a blessing in disguise.
I was able to resume the interrupted clone with a simple "git svn fetch", and it ran much faster with the now radically smaller heap.
This, worked so well, in fact, that I got into the habit of interrupting and restarting the process every evening and every morning. A few days later it was done.

中似乎存在内存泄漏git-svn。该git-svn进程的大小增长缓慢,大约两周后,它的驻留大小为 1.2 GB,此时操作系统拒绝让它分叉。
事情是,这是因祸得福。
我能够用一个简单的“ git svn fetch”来恢复被中断的克隆,而且它在现在非常小的堆上运行得更快。
事实上,这非常有效,以至于我养成了每天晚上和每天早上中断和重新开始这个过程的习惯。几天后就大功告成了。

You start your adventures with git-svnby cloning an existing Subversion repository:

您可以git-svn通过克隆现有的 Subversion 存储库来开始您的冒险:

git svn clone url://path/to/repo -s

The -sflag assumes that your repository uses the "trunk, branches, tags" convention. If not, you have to specify manually which directories represent branches and tags, if you want Git to know about them.

This will take a long time, as it will fetch every single revision from SVN and commit locally. If for any reason it stops, you can resume with git svn fetch.

-s标志假定您的存储库使用“主干、分支、标签”约定。如果没有,你必须手动指定哪些目录代表分支和标签,如果你想让 Git 知道它们。

这将需要很长时间,因为它将从 SVN 获取每个修订版并在本地提交。如果由于任何原因它停止,您可以使用 继续git svn fetch

回答by Brandon Yarbrough

I found a blog postthat provided what (I hope) is a correct answer.

我找到了一篇博客文章,其中提供了(我希望)正确的答案。

Apparently, running git svn fetcheffectively completes the clone operation. Here's hoping!

显然,运行git svn fetch有效地完成了克隆操作。这里是希望!

回答by Tom Saleeba

As VonC, CaptainAwesomePants and Archi all said git svn fetchdoes the trick. I was doing a git svn clone url... --authors-file=path/to/fileand the clone failed because one of the authors wasn't in the authors file. I added the author to the file and ran git svn fetchand it continued from where it left off and looking at the git log later, it seems that it used the newly added author to replace the commit author's name so all was sweet.

正如 VonC、CaptainAwesomePants 和 Archi 所说的git svn fetch那样。我正在做一个git svn clone url... --authors-file=path/to/file克隆失败,因为其中一位作者不在作者文件中。我将作者添加到文件中并运行git svn fetch,它从停止的地方继续,稍后查看 git 日志,似乎它使用新添加的作者来替换提交作者的姓名,所以一切都很甜蜜。

回答by zan-xhipe

From at least git 2.1.0 you can resume by just reissuing git svn clone

至少从 git 2.1.0 开始,您只需重新发布即可恢复 git svn clone

However this will duplicate some entries in your .git/config remove those and everything will be fine

但是,这会在您的 .git/config 中复制一些条目,删除它们,一切都会好起来的