如何git-svn克隆Subversion版本库中的最后n个版本? [英] How to git-svn clone the last n revisions from a Subversion repository?

查看:443
本文介绍了如何git-svn克隆Subversion版本库中的最后n个版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何使用Subversion存储库中的git-svn创建浅拷贝,例如



git clone 命令可以从a中得到最后n个修订版本Git仓库,如果你使用 - depth 选项,即得到仓库的浅表副本。例子:

  git clone --depth 3 git:// some / repo myshallowcopyrepo 

git-svn是否有类似的选项?

我的发现如此远

到目前为止,我只找到 -rN 选项,其中 N 是拉动的修改。例子:

  git svn clone -rN svn:// some / repo 

根据文档可以使用 -r $ REVNUMBER:HEAD 。我尝试了以下获得最后3个修订,它们返回了错误信息。

  $ git svn clone --prefix = svn / -s -rHEAD〜3:HEAD http:// some / svn / repo。 
修订参数:HEAD〜3:HEAD不能被git-svn所理解

HEAD〜3 与第三个但最后一个修订版534的实际数量相同。这很有效,但这需要我先计算出第三个修订版本号,但最后一个提交。 / p>

  $ git svn clone --prefix = svn / -s -r534:HEAD http:// some / svn / repo。 

文档

git-clone



git-svn

-r $ REV:HEAD )。


$ b $

例如: git svn clone -s -r1450:HEAD some / svn / repo



Git的数据结构基于有向无环图(DAG)中的指针,这使得返回 n 提交变得微不足道。但是在SVN中(因此在Git-SVN中),您必须自己找到修订版本号。


Problem

How do you create a shallow copy with git-svn from a Subversion repository, e.g. how do you pull only the last three revisions?

The git clone command can get the last n revisions from a Git repository if you use the option --depth, i.e. you get a shallow copy of the repository. Example:

git clone --depth 3 git://some/repo myshallowcopyrepo

Is there a similar option for git-svn?

My discoveries so far

So far I've only found the -rN option where N is the revision to pull. Example:

git svn clone -rN svn://some/repo

According to the documentation there is the possibility to use -r$REVNUMBER:HEAD. I tried the following to get the last 3 revisions which returned an error message.

$ git svn clone --prefix=svn/ -s -rHEAD~3:HEAD http://some/svn/repo .
revision argument: HEAD~3:HEAD not understood by git-svn

So I replaced HEAD~3 with the actual number of the third but last revision 534. That worked, but that requires me to first figure out the revision number of the third but last commit.

$ git svn clone --prefix=svn/ -s -r534:HEAD http://some/svn/repo .

Documentation

git-clone

git-svn

解决方案

You've already discovered the simplest way to specify a shallow clone in Git-SVN, by specifying the SVN revision number that you want to start your clone at ( -r$REV:HEAD).

For example: git svn clone -s -r1450:HEAD some/svn/repo

Git's data structure is based on pointers in a directed acyclic graph (DAG), which makes it trivial to walk back n commits. But in SVN ( and therefore in Git-SVN) you will have to find the revision number yourself.

这篇关于如何git-svn克隆Subversion版本库中的最后n个版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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