2009-07-16 68 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拋出了它的手,並提取了所有的歷史記錄以找出答案。 (這種方法仍然需要每個位置的完整提取,但這比每個標記的完整歷史提取要快得多)

相關問題