Re: [git-p4] Trouble importing all perforce branches into git repository
From: Thomas Berg <hidden>
Date: 2016-06-15 22:51:29
On Thu, Jun 16, 2011 at 10:28 AM, tumik [off-list ref] wrote:
Did you get it working so that the branch integrates at Perforce show up as merges in git? I have been trying to do this for tens of hours now and just can't get it working.. I have tried making the branch mapping both ways, and even both at the same time but with no success. I have succesfully imported the two testing branches to git, but if I look at it in gitk for example, the history is linear and there are no merges from the other branch (it shows up as a normal commit, without the parent from other branch, just adding all lines that the merging did). in p4v it shows up as it should!
git-p4 only uses the branch mapping for the initial commit on a branch. It does not attempt to detect merges after that point. After importing to git, merges just appear as regular commits in the history. Unfortunately, implementing a general solution for this is non-trivial. Perforce branches and merges per file, meaning that partial merges are possible in Perforce. Such states can not be correctly represented in Git, and depending on your needs, you may or may not want a particular partial merge to be considered as a git merge. There was another script called git-p4raw for importing Perforce history to git, which does merge detection. It solved the problem by having configurable rules for what should be regarded as a merge, and it supported manually reviewing the decisions afterwards (iirc). One possibly useful feature in git-p4 would be an option to regard every integration as a complete merge, which shouldn't be too hard to implement. But this would break every time someone did a single-file integration between two branches (which happens quite often in my experience, for cherry-picking changes etc.). Thomas