/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Aaron Bentley
  • Date: 2007-07-17 18:28:49 UTC
  • mto: (1551.19.24 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 2639.
  • Revision ID: abentley@panoramicfeedback.com-20070717182849-ffu3wxsll06lhc9a
Move plan merge to tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
    osutils,
77
77
    patiencediff,
78
78
    progress,
 
79
    merge,
79
80
    ui,
80
81
    )
81
82
from bzrlib.errors import (
983
984
        ver_a = osutils.safe_revision_id(ver_a)
984
985
        ver_b = osutils.safe_revision_id(ver_b)
985
986
        ancestors_b = set(self.get_ancestry(ver_b, topo_sorted=False))
986
 
        def status_a(revision, text):
987
 
            if revision in ancestors_b:
988
 
                return 'killed-b', text
989
 
            else:
990
 
                return 'new-a', text
991
987
        
992
988
        ancestors_a = set(self.get_ancestry(ver_a, topo_sorted=False))
993
 
        def status_b(revision, text):
994
 
            if revision in ancestors_a:
995
 
                return 'killed-a', text
996
 
            else:
997
 
                return 'new-b', text
998
 
 
999
989
        annotated_a = self.annotate(ver_a)
1000
990
        annotated_b = self.annotate(ver_b)
1001
 
        plain_a = [t for (a, t) in annotated_a]
1002
 
        plain_b = [t for (a, t) in annotated_b]
1003
 
        blocks = KnitSequenceMatcher(None, plain_a, plain_b).get_matching_blocks()
1004
 
        a_cur = 0
1005
 
        b_cur = 0
1006
 
        for ai, bi, l in blocks:
1007
 
            # process all mismatched sections
1008
 
            # (last mismatched section is handled because blocks always
1009
 
            # includes a 0-length last block)
1010
 
            for revision, text in annotated_a[a_cur:ai]:
1011
 
                yield status_a(revision, text)
1012
 
            for revision, text in annotated_b[b_cur:bi]:
1013
 
                yield status_b(revision, text)
1014
 
 
1015
 
            # and now the matched section
1016
 
            a_cur = ai + l
1017
 
            b_cur = bi + l
1018
 
            for text_a, text_b in zip(plain_a[ai:a_cur], plain_b[bi:b_cur]):
1019
 
                assert text_a == text_b
1020
 
                yield "unchanged", text_a
 
991
        return merge._plan_annotate_merge(annotated_a, annotated_b,
 
992
                                          ancestors_a, ancestors_b)
1021
993
 
1022
994
 
1023
995
class _KnitComponentFile(object):