Merging Without a Base in Perforce Helix
I recently had a question about merging files in Perforce Helix that have no direct lineage.
For example, let's say you want to merge file //depot/main/foo.c (source) to //depot/dev/foo.c (target), which is fine, but you realize the target file was not branched from the source and there is no base (common ancestor). To determine the base, Helix uses integration history created by previous integration commands to know which file revisions to integrate. However, since dev/foo.c was not branched from main/foo.c there is no integration history between these two paths: a baseless merge.
To handle this scenario Helix does a two-way merge for the best results. All the diffs are considered conflicts. Why? Because in the absence of a base, we do not have any way to determine what differences are “changes” relative to the base, which is how we normally determine whether diffs are conflicting or not. We found the best and most accurate way to handle this scenario is scheduling a two-way merge.
In the past, Helix would not allow baseless merges without the use of p4 integ command flags;
-i/-I uses the first revision of the source as the base for baseless merges, rather than an empty file.
With the old "-i" behavior, an arbitrarily chosen base can lead to lost changes as seen in the figure below.
This is why we changed the behavior. If you are stuck in the past, these flags are preserved for backward compatibility but are deprecated.
To recap, with the current integration behavior, no flags are needed to handle baseless merges. The Helix integration engine does the right thing for a more realistic and accurate result! Happy merging!