Part of bzrlib.merge3 View In Hierarchy
Given BASE, OTHER, THIS, tries to produce a combined text incorporating the changes from both BASE->OTHER and BASE->THIS. All three will typically be sequences of lines.
Method | __init__ | Constructor. |
Method | merge_lines | Return merge in cvs-like form. |
Method | merge_annotated | Return merge with conflicts, showing origin of lines. |
Method | merge_groups | Yield sequence of line groups. Each one is a tuple: |
Method | merge_regions | Return sequences of matching and conflicting regions. |
Method | reprocess_merge_regions | Where there are conflict regions, remove the agreed lines. |
Static Method | mismatch_region | Undocumented |
Method | find_sync_regions | Return a list of sync regions, where both descendents match the base. |
Method | find_unconflicted | Return a list of ranges in base that are not conflicted. |
Method | _refine_cherrypick_conflict | When cherrypicking b => a, ignore matches with b and base. |
Parameters | base | lines in BASE |
a | lines in A | |
b | lines in B | |
is_cherrypick | flag indicating if this merge is a cherrypick. When cherrypicking b => a, matches with b and base do not conflict. | |
allow_objects | if True, do not require that base, a and b are plain Python strs. Also prevents BinaryFile from being raised. Lines can be any sequence of comparable and hashable Python objects. |
Most useful for debugging merge.
Yield sequence of line groups. Each one is a tuple:
This returns tuples, where the first value says what kind we have:
Method is as follows:
The two sequences align only on regions which match the base and both descendents. These are found by doing a two-way diff of each one against the base, and then finding the intersections between those regions. These "sync regions" are by definition unchanged in both and easily dealt with.
The regions in between can be in any of three cases: conflicted, or changed on only one side.
Lines where both A and B have made the same changes are eliminated.