Perforce to Git: Invalid option: -r

Sandra K Source

I am trying to migrate a project from Perforce into Git. I am using git-p4 as my main tool to do the heavy lifting for me, and it comes by default with Git on Windows:

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

Following Migrating Perforce to Git in Windows, I have reached the step where I execute my cloning command: git p4 clone <PerforceRepo> (where p4 is an alias for the file

I keep getting error:

Invalid option: -r.

C:\P4-To-Git>git p4 clone //depot/C:\build\[email protected] .
Importing from //depot/C:/build/[email protected] 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>
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3834, in main
    if not
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3706, in run
    if not, 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'

I have looked into p4-git python file and there is no place where -r is being used. Any help?



answered 3 months ago Sam Stafford #1

Try setting git-p4.retries to 0?

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

Or upgrade your p4 executable so it supports the -r global flag -- this option was added in the 2012.2 release:

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.

comments powered by Disqus