git-p4同步不工作 - 神秘的堆栈跟踪

问题描述:

我试图用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

我们只是碰到了这个自己。 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

这是一个固定在使用基本上由rbergman提供的补丁的git-P4的最新版本的错误。有关更多详细信息,请参见http://git.kernel.org/?p=git/git.git;a=commit;h=562d53fa69933b3ade2691b99cbe67722313f43c;这个补丁可能出现在1.6.x以后的版本中,并且绝对是1.7.x版本的git。