簡體   English   中英

git-p4 sync不起作用-神秘的堆棧跟蹤

[英]git-p4 sync not working - mysterious stack trace

我正在嘗試使用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'

那時我進入腳本並打印了文件dict,並獲得了更多詳細信息,為了清晰和匿名起見,我將對其進行修改。 錯誤的字典看起來像這樣:

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

如您所見,錯誤的dict是我的客戶端視圖中不存在的文件。 我相信這是問題的根源。 但是,我顯然使用--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

我們自己碰到了這個。 P4似乎在去年添加了一些新命令,而git-p4並不完全支持這些命令。 特別是“移動/刪除”和“移動/添加”。

為了解決此問題,我們更改了這一行:

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

至:

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

到目前為止,這對我們有用,但是我不會斷言這一定是一個可靠的解決方案。

這是一個錯誤,該錯誤已在git-p4的最新版本中使用rbergman提供的修補程序修復。 有關更多詳細信息,請參見http://git.kernel.org/?p=git​​/git.git;a=commit;h=562d53fa69933b3ade2691b99cbe67722313f43c 此修補程序可能出現在更高的1.6.x版本之一中,並且肯定出現在git的1.7.x版本中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM