【发布时间】:2018-08-22 02:42:08
【问题描述】:
我正在尝试将项目从 Perforce 迁移到 Git。我使用git-p4 作为我的主要工具来为我完成繁重的工作,它默认带有 Windows 上的 Git:
C:\Program Files\Git\mingw64\libexec\git-core\git-p4.
在Migrating Perforce to Git in Windows 之后,我已经到了执行克隆命令的步骤:git p4 clone <PerforceRepo>(其中 p4 是文件 git-p4.py 的别名)
我不断收到错误:
无效选项:-r。
C:\P4-To-Git>git p4 clone //depot/C:\build\mainline@all .
Importing from //depot/C:/build/mainline@all into .
Reinitialized existing Git repository in C:/P4-To-Git/.git/
Perforce client error:
p4 -h for usage.
Invalid option: -r.
Traceback (most recent call last):
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3840, in <module>
main()
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3834, in main
if not cmd.run(args):
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3706, in run
if not P4Sync.run(self, depotPaths):
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3546, in run
changes = p4ChangesForPaths(self.depotPaths, self.changeRange, self.changes_block_size)
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 852, in p4ChangesForPaths
changeEnd = p4_last_change()
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 317, in p4_last_change
return int(results[0]['change'])
KeyError: 'change'
我查看了 p4-git python 文件,没有使用-r 的地方。有什么帮助吗?
【问题讨论】:
-
您的 P4 路径似乎不正确:
//depot/C:\build\mainline@all。如果 git-p4 支持,请使用仓库路径(如//depot/foo/bar/mainline/...)或本地路径(C:\build\mainline\...)。另外,您确定“@all”吗?那是标签吗? -
@sferencik 我的 p4 路径似乎是有效的,因为其他(您的)路径示例不起作用 + 我示例的第一行显示路径正确。我不确定你的意思是什么?你能输入整个命令吗?
@all告诉 git-p4 也导入所有历史记录 -
//depot/foo/bar/mainline/...只是一个例子。自然,您的项目不在“foo/bar”下。您需要找到项目的实际仓库路径。你完全使用 Perforce 吗?或者您团队中可以帮助您找出正确的仓库路径的人?我强烈怀疑//depot/C:\build\mainline是否正确。 -
@sferencik 抱歉,我现在很困惑,您的第一条评论建议使用 "foo/bar" 仓库路径,然后您的第二条 cmets 说它看起来不像“foo/bar”。你能帮我找到我的仓库路径吗?显示一个仓库路径示例?
-
@SandraK 连接到您的 Perforce 服务器并尝试运行一些命令,例如
p4 depots和p4 files //depot/...和p4 dirs //depot/*。这可能会让您大致了解仓库的外观,并建议您要导入的路径。如果您在尝试运行这些命令时遇到连接错误,那么这项工作注定要失败,因为您没有可以通过此机器上设置的P4PORT值访问的 Perforce 服务器(这是 git-p4 将尝试的使用)。
标签: git version-control migration perforce git-p4