version-controlmergebranchdiffdiffmerge

3-way merge (update) file based on differences in 2 branches


I have 3 text files:

  1. Branch A, version i (Ai)
  2. Branch A, version i-1 (Ai-1)
  3. Branch B, version i-1 (Bi-1)

Is there any merge/diff tool to produce Branch B, version i (Bi) with the following rules:

  1. if Ai=Ai-1, then use Bi-1 in Bi
  2. if Ai<>Ai-1=Bi-1, then use Ai in Bi
  3. if Ai<>Ai-1<>Bi-1, then CONFLICT

I tried DiffMerge from SourceGear Vault, but could not find such automated option.

This wiki article did not help either:

en.wikipedia.org/wiki/Merge_(revision_control)


Solution

  • Our tool ECMerge should do that (use Ai-1 as ancestor, Ai as left, Bi-1 as right, and specify Bi as "result location"). You can do that at file or folder level. If you want no attempt to merge inside the file, and directly report a conflict in case of any Ai<>Ai-1<>Bi use the Text Comparison/File Merges/Surround changes: all.

    Some tools with no "production" capabilities might do it as well by first copying the Bi-1 version to Bi and then provoking a 3-way merge on Ai/Bi with Ai-1 as ancestor.