1

我正在尝试将项目从 Perforce 迁移到 Git。我使用git-p4它作为我的主要工具来为我完成繁重的工作,它默认与 Windows 上的 Git 一起提供:

C:\Program Files\Git\mingw64\libexec\git-core\git-p4.

Windows 中将 Perforce 迁移到 Git 之后,我已经到了执行克隆命令的步骤:(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使用的地方。有什么帮助吗?

4

1 回答 1

5

尝试设置git-p4.retries为0?

if retries > 0:
    # Provide a way to not pass this option by setting git-p4.retries to 0
    real_cmd += ["-r", str(retries)]

或者升级你的p4可执行文件,使其支持-r全局标志——这个选项是在 2012.2 版本中添加的:

Minor new functionality in 2012.2

    #384638 *** ** *
        The net.maxwait configurable can be used to specify a hard limit
        (in seconds) on the maximum time that a connection will wait for
        any single network send or receive to complete. The 'p4 sync'
        command now supports a '-r' global flag to specify that the sync
        command should be retried if a network error occurs.
于 2018-03-13T18:31:07.650 回答