Search code examples
perforcep4vp4merge

How do I select the common base file manually for P4Merge?


I am trying to merge a file.

I have the main branch and another branch B that was branched from main. Both branches have changes. The main branch was merged to B at some point; but the merge on B was undid directly afterwards. After some more changes on both branches I'm trying to merge again but perforce selects the incorrect base file revision from the main branch.

I need to be able to select the common base file manually so that it will do the merge correctly. Unfortunately I was unable to find any way of doing this. If anyone knows how to resolve this, that would be much appreciated.


Solution

  • If the merge was undone via the p4 undo command, you should be able to redo it with a regular merge operation by setting the dm.integ.undo configurable:

    (p4 help undoc)
        dm.integ.undo            0 Enable re-integration of undone changes
    

    With that configurable enabled, the "credit" granted by each integration is considered to be nullified by an "undo" operation, making each previously merged revision eligible for a merge as if it had never been merged previously. (The default behavior is for the undo to be considered the same as an edit, so that it's combined with unmerged changes, but previously merged changes aren't re-merged.)

    If that's not an option, the best solution is to use the -f flag. Specify the exact range of changes you want to merge, along with the -f flag, and the revision immediately before that range will be used as the base. E.g.:

    p4 integ -f main/...@100,400 B/...
    

    will use main/...@99 as the base for the resolve(s).