git-p4提交失败

3
我正在使用git-p4在本地使用git并尝试将更改提交回perforce服务器。但是,我无法成功提交更改到服务器。
我已经设置了一个客户端,以便在客户端中包含所有库依赖项(遵循Using git-p4 to setup a git clone of a perforce client中的建议)。
//depot/libA/... //workspace/libA/...
//depot/libB/... //workspace/libB/...

然而对于主要的源码行,我在工作目录中执行以下操作:

git-p4 clone //depot/my_project

这将在工作区中创建并填充my_project目录。

这样src中的代码可以引用库。

问题是当我执行git-p4 rebase时,会出现以下错误:

$git-p4 rebase
Traceback (most recent call last):
  File "/home/user/bin/git-p4", line 2362, in <module>
    main()
  File "/home/user/bin/git-p4", line 2357, in main
    if not cmd.run(args):
  File "/home/user/bin/git-p4", line 2051, in run
    sync.run([])
  File "/home/user/bin/git-p4", line 2004, in run
    changes = self.p4.p4ChangesForPaths(self.depotPaths, self.changeRange)
  File "/home/user/bin/git-p4", line 232, in p4ChangesForPaths
    assert depotPaths
AssertionError

当我执行 git-p4 submit 命令(在我单独进行一次更改并使用 git commit -a -m "test" 命令之后):

$ git-p4 submit --verbose
Reading pipe: git name-rev HEAD
Reading pipe: git config git-p4.allowSubmit
Reading pipe: git rev-parse --symbolic  --remotes
Reading pipe: git rev-parse p4/master
Reading pipe: git notes --ref=git-p4 show 6b75260b956cb72102014783fcfcb2e0da6eb637
Reading pipe: git notes --ref=git-p4 show HEAD~0
Reading pipe: git notes --ref=git-p4 show HEAD~1
Reading pipe: git notes --ref=git-p4 show HEAD~2
Reading pipe: git notes --ref=git-p4 show HEAD~3

它需要很长时间(是否要求服务器检索所有更改集?),并且会出现错误: Traceback(最近的调用最先):

 File "/home/user/bin/git-p4", line 2362, in <module>
    main()
  File "/home/user/bin/git-p4", line 2357, in main
    if not cmd.run(args):
  File "/home/user/bin/git-p4", line 1088, in run
    self.depotPath = settings['depot-paths'][0]
KeyError: 'depot-paths'

我应该注意到,我没有使用git config来设置任何git-p4选项(https://git.wiki.kernel.org/index.php/Git-p4_Usage上的wiki似乎没有提到需要这样做)。

1个回答

2

你的客户端规范是否包含//depot/my_project/...

也许你可以将库存放在一个客户端规范中,将项目放在另一个客户端规范中。

例如:

working/
    project-git/
       .perforce -> P4CONFIG with project-spec
       <p4-git project checkout>
    .perforce -> P4CONFIG with libs-spec
    libraries
perforce/
    .perforce -> P4CONFIG with project-spec
    <p4 project checkout>

不,它并没有,这就是问题所在。谢谢!是否有可能在客户端规格中具有仓库路径,而在进行 p4 sync 同步时不进行同步呢?因为进行同步时,Perforce 可能会覆盖 Git 代码库。 - user231536
我有一个类似的问题,只是我的客户端规范包括//depot/address。有人知道不同的解决方案吗? - Wojciech Górski
@WojciechGórski 如果您有类似但不同的问题,请提出一个问题,参考此问题,并突出差异。 - Douglas Leeder
1
我找出了问题所在。我发布了一个答案在我的问题页面上:http://stackoverflow.com/questions/12367328/git-p4-depot-path-error/12384217#12384217 - Wojciech Górski

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接