2011-05-19 49 views
7

我試圖從我公司的Perforce倉庫將項目導入到倉庫倉庫。我已經成功地將單個分支合併到一個git倉庫中,但是我想要做的是將整個項目和所有分支合併到一起,但是我無法正常工作。無法將所有執行分支導入到git倉庫

我有我的.p4settings文件:

P4PORT=perforce-server.local:1666 
P4USER=my.username 
P4CLIENT=my.clientspec.name 

Clientspec是相當簡單:

//project/... //my.clientspec.name/project/... 
-//project/External/... //my.clientspec.name/project/External/... 

第二行是從結賬排除外部庫二進制文件。

我用下面的命令行啓動的git-P4進口:

git p4 clone --verbose --detect-branches --max-changes=100 //project/[email protected] 

此經過,並檢查所有的分支名稱等,並嘗試導入了從第一個提交(這個特殊的項目開始在變更表771)

Importing from //project/[email protected] into project 
Initialized empty Git repository in /Users/grant/Development/git_test/project/.git/ 
Reading pipe: git config git-p4.useclientspec 
Reading pipe: git config git-p4.user 
Reading pipe: git config git-p4.password 
Reading pipe: git config git-p4.port 
Reading pipe: git config git-p4.host 
Reading pipe: git config git-p4.client 
p4 -G branches 
Opening pipe: p4 -G branches 
p4 -G branch -o branch-1 
Opening pipe: p4 -G branch -o branch-1 
Reading pipe: git config --bool core.ignorecase 
p4 -G branch -o branch-2 
... 
Opening pipe: p4 -G branch -o branch-n 
p4-git branches: [] 
initial parents: {} 

我不知道,如果P4-的Git分支,和最初的父母應該是空的這裏,但他們。

最後,我們得到的地方,這是即將開始導入修改列表進入混帳點並執行以下操作:

Getting p4 changes for //project/... 
p4 changes //project/... 
Reading pipe: p4 changes //project/... 
p4 -G describe 771 
Opening pipe: p4 -G describe 771 
Importing revision 771 (1%)branch is MAIN 

    Importing new branch RCMerge/MAIN 
p4 changes //RCMerge/MAIN/[email protected],770 
Reading pipe: p4 changes //RCMerge/MAIN/[email protected],770 

    Resuming with change 771 
parent determined through known branches: Branch-foo 
looking for initial parent for refs/remotes/p4/project/MAIN; current parent is refs/remotes/p4/project/Branch-foo 
commit into refs/remotes/p4/project/MAIN 
parent refs/remotes/p4/project/Branch-foo 
p4 -G -x - print 
Opening pipe: p4 -G -x - print 
Glue/source/.empty 
fatal: Invalid ref name or SHA1 expression: refs/remotes/p4/project/Branch-foo 
fast-import: dumping crash report to .git/fast_import_crash_26002 

這裏是上面提到的文件:

fast-import crash report: 
    fast-import process: 26002 
    parent process  : 26000 
    at Thu May 19 11:51:54 2011 

fatal: Invalid ref name or SHA1 expression: refs/remotes/p4/project/Branch-foo 

Most Recent Commands Before Crash 
--------------------------------- 
    checkpoint 
    commit refs/remotes/p4/project/MAIN 
    committer Some User <[email protected]> 1253574589 -0800 
    data <<EOT 
* from refs/remotes/p4/project/Branch-foo 

Active Branch LRU 
----------------- 
    active_branches = 0 cur, 5 max 

    pos clock name 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

Inactive Branches 
----------------- 
refs/remotes/p4/project/MAIN: 
    status  : dirty 
    tip commit : 0000000000000000000000000000000000000000 
    old tree : 0000000000000000000000000000000000000000 
    cur tree : 0000000000000000000000000000000000000000 
    commit clock: 0 
    last pack : 


Marks 
----- 

------------------- 
END OF CRASH REPORT 

現在,作爲一個Perforce新手,我不知道這意味着什麼,也不知道如何解決這個問題,或者甚至可能。有沒有人遇到過類似的問題?如果是這樣,你是如何解決它的?

回答

4

我終於想出瞭解決這個問題的辦法。事實證明,Perforce分支映射是相反的,這就是這個問題的根源。

科-foo和分支主要的,它應該有一個分支映射像這樣:

//project/MAIN/... //project/Branch-foo/... 

然而,誰創造了分公司的人,相反的映射,從而導致此:

//project/Branch-foo/... //project/MAIN/... 

這個困惑的git-p4作爲主要的第一個變更列表從#771開始,而Branch-foo的變更列表從#7652開始,因此它在Branch-foo中找不到任何父項並且崩潰。將分支規格更改爲上面列出的第一個固定了問題。