2010-04-27 67 views
0

我試圖用git-p4克隆perforce倉庫。我一直在git-p4腳本中遇到問題,其中git-p4嘗試訪問未定義的字典鍵並拋出一個跟蹤。git-p4同步不工作 - 神祕的堆棧跟蹤

[~/p4/[email protected]] (master) $ 
git p4 sync --verbose --use-client-spec //depot/prod/ 
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 -u mkramer -c mkramer -G client -o 
Opening pipe: p4 -u mkramer -c mkramer -G client -o 
None 
Doing initial import of //depot/prod/ from revision #head into refs/remotes/p4/master 
p4 -u mkramer -c mkramer -G files //depot/prod/...#head 
Opening pipe: p4 -u mkramer -c mkramer -G files //depot/prod/...#head 
commit into refs/remotes/p4/master 
p4 -u mkramer -c mkramer -G -x - print 
Opening pipe: p4 -u mkramer -c mkramer -G -x - print 
p4 -u mkramer -c mkramer -G users 
Opening pipe: p4 -u mkramer -c mkramer -G users 
Traceback (most recent call last): 
    File "/home/mkramer/git/bin/git-p4", line 1922, in <module> 
    main() 
    File "/home/mkramer/git/bin/git-p4", line 1917, in main 
    if not cmd.run(args): 
    File "/home/mkramer/git/bin/git-p4", line 1651, in run 
    self.importHeadRevision(revision) 
    File "/home/mkramer/git/bin/git-p4", line 1461, in importHeadRevision 
    self.commit(details, self.extractFilesFromCommit(details), self.branch, self.depotPaths) 
    File "/home/mkramer/git/bin/git-p4", line 1063, in commit 
    data = file['data'] 
KeyError: 'data' 

我走進了劇本,在這一點上正確打印出來的文件字典,並得到一些更多的細節,我將修改爲清晰起見&匿名。出故障的字典是這樣的:

{'action': 'move/delete', 'path': '//depot/prod/foo/bar', 'rev': '3', 'type': 'xtext'} 

我的P4的客戶是這樣的:

Client: mkramer 
Update: 2010/04/27 14:46:10 
Access: 2010/04/27 14:51:29 

Owner: mkramer 
Description: 
     Created by mkramer. 
Root: z:\p4 
AltRoots: 
     z:\p4 
     /home/mkramer/p4 
Options:  noallwrite noclobber nocompress unlocked nomodtime normdir 
SubmitOptions: submitunchanged 
LineEnd:  share 
View: 

     //depot/prod/... //mkramer/prod/... 
     -//depot/.../foo/... //mkramer/.../foo/... 

正如你所看到的,有故障的字典是沒有在我的客戶視圖存在的文件。我相信這是問題的根源。但是,我清楚地運行--use-client-spec命令。我也試着git config git-p4.useclientspec true 詳細輸出使它看起來像它的拉我的觀點出

Opening pipe: p4 -u mkramer -c mkramer -G client -o. 

如果我跑p4 -u mkramer -c mkramer client -o我看到正確的觀點。

如果我運行p4 -u mkramer -c mkramer files //depot/prod/...#head我看到不在我看來的文件。

版本我的軟件:

[~/p4/[email protected]] (master) $ p4 -V 
Perforce - The Fast Software Configuration Management System. 
Copyright 1995-2009 Perforce Software. All rights reserved. 
Rev. P4/LINUX26X86_64/2009.1/205670 (2009/06/29). 
[~/p4/[email protected]] (master) $ git --version 
git version 1.7.0.5 
[~/p4/[email protected]] (master) $ python -V 
Python 2.6.5 
+0

更新時間更多信息 – masonk 2010-04-27 20:59:05

回答

3

我們只是碰到了這個自己。 P4似乎在去年增加了一些新的命令,git-p4並未完全支持;特別是「移動/刪除」和「移動/添加」。

爲了解決這個問題,我們改了行:

if file["action"] in ("delete", "purge"): 

到:

if file["action"] in ("delete", "purge", "move/delete"): 

到目前爲止,這爲我們工作,但我不會斷言,這是必然是一個強大的修復。

+0

你是男人!我已經放棄了這一點。謝謝! – masonk 2010-05-13 00:49:18