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

发布于 2024-08-31 04:37:42 字数 2859 浏览 2 评论 0原文

我正在尝试使用 git-p4 克隆 perforce depot。我一直在 git-p4 脚本中遇到问题,其中 git-p4 尝试访问未定义的字典键并抛出跟踪。

[~/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

I'm trying to use git-p4 to clone perforce depot. I keep running into a problem in the git-p4 script, where git-p4 tries to access a dict key that is not defined and throws a trace.

[~/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'

I went into the script and printed out the file dict right at that point and got some more details, which I'll revise for clarity & anonymity. The faulty dict looked like this:

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

My p4 client looks like this:

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/...

As you can see, the faulty dict is a file that does not exist in my client view. I believe this is the source of the problem. However, I am clearly running the command with --use-client-spec. I've also tried git config git-p4.useclientspec true
The verbose output makes it look like it's pulling my view out of

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

If I run p4 -u mkramer -c mkramer client -o I see the correct view.

If I run p4 -u mkramer -c mkramer files //depot/prod/...#head I see files that aren't in my view.

Versions of my software:

[~/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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天赋异禀 2024-09-07 04:37:42

我们自己也遇到过这个问题。 P4 去年似乎添加了一些 git-p4 不完全支持的新命令;特别是“移动/删除”和“移动/添加”。

为了解决这个问题,我们将行:更改

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

为:

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

到目前为止,这对我们有用,但我不会断言这一定是一个可靠的解决方案。

We just ran into this ourselves. P4 appears to have added some new commands last year that git-p4 doesn't fully support; particularly "move/delete" and "move/add".

In order to work around the issue, we changed the line:

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

to:

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

So far this is working for us, but I won't assert that this is necessarily a robust fix.

空名 2024-09-07 04:37:42

这是一个错误,已在最新版本的 git-p4 中修复,主要使用 rbergman 提供的补丁。请参阅 http://git.kernel.org/ ?p=git​​/git.git;a=commit;h=562d53fa69933b3ade2691b99cbe67722313f43c 了解更多详细信息;该补丁可能出现在较晚的 1.6.x 版本之一中,并且肯定出现在 git 的 1.7.x 版本中。

This is a bug that was fixed in recent versions of git-p4 using essentially the patch provided by rbergman. See http://git.kernel.org/?p=git/git.git;a=commit;h=562d53fa69933b3ade2691b99cbe67722313f43c for more details; this patch probably appeared in one of the later 1.6.x releases and is definitely in the 1.7.x releases of git.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文