Git svn clone:如何推迟修订历史记录的提取 [英] Git svn clone: How to defer fetch of revision history

查看:138
本文介绍了Git svn clone:如何推迟修订历史记录的提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常遇到这样的情况,我想立即在SVN存储库上工作。但是普通的 git svn clone [url] 也克隆了整个历史。所以我想加快速度。第一部分是只把最后一个版本提取到你的Git仓库中。我这样做:

  URL = http://google-web-toolkit.googlecode.com/svn/trunk/ 
REV =`svn info $ URL | grep修订版:| awk'{print $ 2}'`
PROJECT_FOLDER = google-web-toolkit-readonly

git svn clone -r $ REV:HEAD $ URL $ PROJECT_FOLDER

(更多信息在StackOverflow文章中:如何git-svn克隆最后n版本的svn

这样我就可以运行,并且可以立即工作,但没有本地的历史记录副本。



问题是,我该如何获取来自svn仓库的历史记录?



最好是可以以1000个修订版块(以相反的顺序)完成,任何帮助在这里将不胜感激:)

解决方案

我发现它是如何完成的。技巧是不要使用 git svn clone 。相反,请分别使用 git svn init git svn fetch 。修改示例:

  URL = http://google-web-toolkit.googlecode.com/svn/trunk/ 
REV =`svn info $ URL | grep修订版:| awk'{print $ 2}'`
PROJECT_FOLDER = google-web-toolkit-readonly

mkdir $ PROJECT_FOLDER
cd!$#进入名为$ PROJECT_FOLDER
的目录git svn init -s $ URL#-s意味着--stdlayout with / trunk / tags / branches
git svn fetch -r $ REV

#hack,hack,hack

#或更新历史记录(在每个循环中获取50次修订
((r = $ REV; r> 0; r- = 50));
do
git svn fetch -r $ r:HEAD
完成


I often have the case that I want to work on a SVN repository right away. But an ordinary git svn clone [url] also clones the entire history. So I want to speed things up. The first part is to fetch only the last revision into your Git repository. I do it like so:

URL=http://google-web-toolkit.googlecode.com/svn/trunk/
REV=`svn info $URL |grep Revision: | awk '{print $2}'`
PROJECT_FOLDER=google-web-toolkit-readonly

git svn clone -r$REV:HEAD $URL $PROJECT_FOLDER

(more info in the StackOverflow article: "How to git-svn clone last n revisions from svn"

This way I'm up and running and can work immediately. But without local copy of the history.

The question is, how do I afterwards fetch history from the svn repository?

And preferably, can this be done in chunks of, say 1000 revisions (in reverse order). Any help here would be greatly appreciated :)

解决方案

I found out how it can be done. The trick is not to use git svn clone. Instead, use git svn init and git svn fetch individually. Modified the example:

URL=http://google-web-toolkit.googlecode.com/svn/trunk/
REV=`svn info $URL |grep Revision: | awk '{print $2}'`
PROJECT_FOLDER=google-web-toolkit-readonly

mkdir $PROJECT_FOLDER
cd !$ #goes into dir named $PROJECT_FOLDER
git svn init -s $URL #-s implies --stdlayout with /trunk /tags /branches
git svn fetch -r $REV

# hack, hack, hack

# or update history (fetch 50 revisions back each loop
for (( r=$REV; r>0; r-=50 )); 
do 
  git svn fetch -r $r:HEAD
done

这篇关于Git svn clone:如何推迟修订历史记录的提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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