Git p4 clone not following file changes to other branches

89 Views Asked by At

I'm trying to migrate my (huge) p4 repo to git. I did p4 clone //proj/branchA@all and it did what was expected - made a repo with the history up to where this branches was created. The issue is that this branch is created from another one, so the first 'commit' is Branching //proj/branchB/... to //proj/branchA/....

Now, when I try to see Annotations using Intellij Idea, I can see the changes all the way up to the creation of the file. The command that Idea runs is filelog -i -l -t -m 1000 /path/to/file. The log is as follows:

...
... ... branch into //proj/branchC/.../file#1
... ... branch into //proj/branchX/.../file#1
change #1234 edit on ...
... ... branch into //proj/branchY/.../file#1
...

Now obviously there is a way to follow the file and see changes beyond what is present on the current branch. Can someone help me to transfer all that history using git p4 or any other service?

2

There are 2 best solutions below

0
Douglas Leeder On

What you can do it clone the two branches to separate repos, then use git to combine them together.

Unfortunately I can't remember the full details for how to graft the branches together.

https://superuser.com/questions/1005412/how-can-i-make-a-set-of-commits-the-children-of-another-commit-in-git

Possibly https://git-scm.com/docs/git-filter-branch will help.

0
Vitor On

AFAIK Git tracks merging per branch, while p4 does it per file. So the first won't be able to store all the information included in the latter. The import process occurs per changelist by patching the diff between the changelist against the latest commit. In this process git-p4 does not look at the file's log to search for integration information. But even if it tried it would not be able to import it to git. So, at the moment git-p4 should be able to import your p4 repository and organize it using git branches, but with some limitations:

  • You need to provide the source and destination branch pairs.
  • The original "branch" creation in p4 can't include modifications, or else it may not correctly detect the source's changelist.