2009-07-16 127 views
32

我看到git svn fetch在我的Subversion版本库中发现分支时反复检索相同的Subversion 版本。我们是 使用标准的Subversion版本库布局,顶级 /trunk,/ tags和/ branches目录(并且使用'git svn init -s'创建的git存储库是 )。但是,有问题的分支是 通常是从trunk中的子目录复制而不是 中继。git svn fetch对分支检索相同的Subversion版本多次

的混帐SVN提取输出通常看起来是这样的:

 
r2537 = d5b22e956157af036d4112e42e8fb927e45758c8 (trunk) 
     M  Enterprise/VC/libgc/SymbolVenue.cpp 
r2538 = cfed4ca0491da0b732f32bfff72ba678450a0915 (trunk) 
Found possible branch point: http://repo/prod_repos/trunk/Enterprise/VC => http://repo/prod_repos/branches/file_conversion, 2523 
W: Refspec glob conflict (ref: refs/remotes/[email protected]): 
expected path: branches/[email protected] 
    real path: trunk/Enterprise/Python 
Continuing ahead with trunk/Enterprise/Python 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: branches/trunk 
    real path: trunk 
Continuing ahead with trunk 
Initializing parent: [email protected] 
     A  gc/QuoteService.cpp 
     A  gc/TestSuite.h 
     A  gc/quote_svc.pro 
     A  gc/QuoteService.h 
..... 

r1 = d349ed8cb2d76596fe2b83224986275be4600fad ([email protected]) 
     D  gc/FixMessageLogger.h 
..... 
r5 = 
r19 = 
r20 = 
..... 

我们又回到修订版1混帐SVN获取然后 继续直到到达 创建分支修订以获取修订。

我在做什么错?无论如何,我告诉git svn取 不能检索它已经拉的修订版吗?

+0

好问题(+1)。这也发生在我身上,似乎浪费了我的时间。 – 2009-11-23 20:05:03

+0

责怪SVN,它存储分支本质上作为存储库的副本;-)一些历史和内部工作由David Wheeler在http://www.dwheeler.com/essays/scm.html – vonbrand 2013-01-25 17:45:24

回答

64

我注意到这个问题,因为我得到了同样的错误信息:

W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: branches/trunk 
    real path: trunk 

原来的.git/config中有重复的线条,似乎混淆混帐svn的,就像这样:

[svn-remote "svn"] 
... 
    branches = project/branches/*:refs/remotes/* 
    tags = project/tags/*:refs/remotes/tags/* 
    branches = project/branches/*:refs/remotes/* 
    tags = project/tags/*:refs/remotes/tags/* 

删除这些重复项解决了我的怪异git-svn行为,也可能适合你。我不确定是什么原因导致git-svn首先复制这些信息。我杀了并继续最初的克隆,这可能是相关的?

+4

给出我有这个问题太。我也杀了最初的克隆并重新启动。看起来可能是原因... – 2010-09-23 16:15:55

2

git-svn由于在SVN存储库中有标签,似乎会重复提取相同的版本。 SVN的标签概念与git的略有不同:SVN tags are actually branches(因此SVN tags are copies)。

再仔细看看你的输出:

r1 = d349ed8cb2d76596fe2b83224986275be4600fad ([email protected])

尽管修正r1 =看起来太熟悉了,该文本的其余部分可能有所不同。至少,标签名称(在本例中为[email protected])不会相同。

我认为防止这种情况的唯一方法是让git-svn跳过SVN标签。如果你不能生活在没有标签,也可以convert the SVN 'tag' branches to real git tags(但你必须获取所有标签分支,第一!)


一个相关的SO有可能的变通问题:Can Git-svn be used on large, branched repositories?

关于这个问题的一些讨论:git-svn --tags should at least /try/ to handle tags as tags

9

删除重复项目对我仍然有问题。每次您重新运行克隆命令时,例如git svn clone svn://.../svnroot --no-metadata -A authors-transform.txt --stdlayout。它增加了两条线。混帐/配置。 我不得不删除包含所有行分支=分支机构/ :参/遥控器/标签=标签/ :参/遥控器/标签/

离开配置看起来像下面:

[core] 
     repositoryformatversion = 0 
     filemode = true 
     bare = false 
     logallrefupdates = true 
[svn-remote "svn"] 
     noMetadata = 1 
     url = svn://.../svnroot 
     fetch = trunk:refs/remotes/trunk 
[svn] 
     authorsfile = /home/users/denn/authors-transform.txt 
~ 
2

如果在任何时候您的资源库的主干存在于SVN的不同位置,请尝试指定此位置以额外获取存储库的配置文件。例如:

[svn-remote "svn"] 
... 
    fetch = project/trunk:refs/remotes/origin/trunk 
    fetch = previous/location/of/trunk:refs/remotes/origin/trunk-old1 
    fetch = another/location/of/trunk:refs/remotes/origin/trunk-old2 
    ... 

对于我正在导入的项目,有许多分支和标签是从这些以前的位置创建的。由于这些是从一个“未知”的地方创建的分支/标签,所以git svn抛出了它的手,并提取了所有的历史记录以找出答案。 (这种方法仍然需要每个位置的完整提取,但这比每个标记的完整历史提取要快得多)