I am trying to migrate from Perforce to Git. Our development is structured as follows:
Version 1.3.0 is created, developed, released to production. Development continues, version 1.3.1 is branched and developed etc..
Currently we have a whole bunch of versions that are created in an increasing order. My task is to import those versions as consecutive branches, i.e. branch 1.3.1 comes out from 1.3.0; branch 1.4.0 comes out from branch 1.3.1 etc...
I am using the following set of commands:
git init
git config --add git-p4.branchList 1.3.0:1.3.1
#continue configuration for all of the branches
git p4 sync --detect-branches //depot/path/to/code@all
Final branchList configuration looks something like that:
[git-p4]
branchList = 1.3.0:1.3.0
branchList = 1.3.0:1.3.1
branchList = 1.3.1:1.4.0
branchList = 1.4.0:1.5.0
etc...
When I run the above commands, I get an error:
Importing revision 457240 (18%)
Importing new branch common/1.4.0
Resuming with change 457240
fatal: ambiguous argument 'refs/remotes/p4/common/1.3.1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Command failed: ['git', 'rev-list', '--reverse', '--no-merges', 'refs/remotes/p4/common/1.3.1']
However if my branchList configuration looks like that:
[git-p4]
branchList = 1.3.0:1.3.0
branchList = 1.3.1:1.3.1
branchList = 1.4.0:1.4.0
branchList = 1.5.0:1.5.0
The import is completely successful, however the branch history is not reflected properly.
What is the problem here?
According to your branchList configuration, branch 1.4.0 is created from branch 1.3.1. But at changelist 457240 where branch 1.4.0 is found for the first time, branch 1.3.1 was still not found!
Is it possible that 1.4.0 and 1.3.1 were both created from 1.3.0?
Your branchList configuration must match the integration history in P4.
To confirm the integration history in P4 choose a file that exists in all branches and is seldom modified and use P4V "Revision Graph" feature. An alternative is to use the CLI command p4 filelog //depot/path/to/file
.