b.m._PlanMergeBase(object) : class documentation

Part of bzrlib.merge View In Hierarchy

Known subclasses: bzrlib.merge._PlanLCAMerge, bzrlib.merge._PlanMerge

No class docstring
Method __init__ Contructor.
Method get_lines Get lines for revisions from the backing VersionedFiles.
Method plan_merge Generate a 'plan' for merging the two revisions.
Method _precache_tip_lines Undocumented
Method _iter_plan Undocumented
Method _get_matching_blocks Return a description of which sections of two revisions match.
Method _unique_lines Analyse matching_blocks to determine which lines are unique
Static Method _subtract_plans Remove changes from new_plan that came from old_plan.
def __init__(self, a_rev, b_rev, vf, key_prefix):
Contructor.
Parametersa_revRevision-id of one revision to merge
b_revRevision-id of the other revision to merge
vfA VersionedFiles containing both revisions
key_prefixA prefix for accessing keys in vf, typically (file_id,).
def _precache_tip_lines(self):
Undocumented
def get_lines(self, revisions):
Get lines for revisions from the backing VersionedFiles.
RaisesRevisionNotPresenton absent texts.
def plan_merge(self):
Generate a 'plan' for merging the two revisions.

This involves comparing their texts and determining the cause of differences. If text A has a line and text B does not, then either the line was added to text A, or it was deleted from B. Once the causes are combined, they are written out in the format described in VersionedFile.plan_merge

def _iter_plan(self, blocks, new_a, killed_b, new_b, killed_a):
Undocumented
def _get_matching_blocks(self, left_revision, right_revision):
Return a description of which sections of two revisions match.

See SequenceMatcher.get_matching_blocks

def _unique_lines(self, matching_blocks):
Analyse matching_blocks to determine which lines are unique
Returnsa tuple of (unique_left, unique_right), where the values are sets of line numbers of unique lines.
@staticmethod
def _subtract_plans(old_plan, new_plan):
Remove changes from new_plan that came from old_plan.

It is assumed that the difference between the old_plan and new_plan is their choice of 'b' text.

All lines from new_plan that differ from old_plan are emitted verbatim. All lines from new_plan that match old_plan but are not about the 'b' revision are emitted verbatim.

Lines that match and are about the 'b' revision are the lines we don't want, so we convert 'killed-b' -> 'unchanged', and 'new-b' is skipped entirely.

API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.