我正在尝试使用 git-p4 克隆 perforce 仓库。我一直在 git-p4 脚本中遇到问题,其中 git-p4 尝试访问未定义的 dict 键并引发跟踪。
[~/p4/prod@ernie02] (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/prod@ernie02] (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/prod@ernie02] (master) $ git --version
git version 1.7.0.5
[~/p4/prod@ernie02] (master) $ python -V
Python 2.6.5