/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

Merge bzr.dev.

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 (
1037
1038
        ver_a = osutils.safe_revision_id(ver_a)
1038
1039
        ver_b = osutils.safe_revision_id(ver_b)
1039
1040
        ancestors_b = set(self.get_ancestry(ver_b, topo_sorted=False))
1040
 
        def status_a(revision, text):
1041
 
            if revision in ancestors_b:
1042
 
                return 'killed-b', text
1043
 
            else:
1044
 
                return 'new-a', text
1045
1041
        
1046
1042
        ancestors_a = set(self.get_ancestry(ver_a, topo_sorted=False))
1047
 
        def status_b(revision, text):
1048
 
            if revision in ancestors_a:
1049
 
                return 'killed-a', text
1050
 
            else:
1051
 
                return 'new-b', text
1052
 
 
1053
1043
        annotated_a = self.annotate(ver_a)
1054
1044
        annotated_b = self.annotate(ver_b)
1055
 
        plain_a = [t for (a, t) in annotated_a]
1056
 
        plain_b = [t for (a, t) in annotated_b]
1057
 
        blocks = KnitSequenceMatcher(None, plain_a, plain_b).get_matching_blocks()
1058
 
        a_cur = 0
1059
 
        b_cur = 0
1060
 
        for ai, bi, l in blocks:
1061
 
            # process all mismatched sections
1062
 
            # (last mismatched section is handled because blocks always
1063
 
            # includes a 0-length last block)
1064
 
            for revision, text in annotated_a[a_cur:ai]:
1065
 
                yield status_a(revision, text)
1066
 
            for revision, text in annotated_b[b_cur:bi]:
1067
 
                yield status_b(revision, text)
1068
 
 
1069
 
            # and now the matched section
1070
 
            a_cur = ai + l
1071
 
            b_cur = bi + l
1072
 
            for text_a, text_b in zip(plain_a[ai:a_cur], plain_b[bi:b_cur]):
1073
 
                assert text_a == text_b
1074
 
                yield "unchanged", text_a
 
1045
        return merge._plan_annotate_merge(annotated_a, annotated_b,
 
1046
                                          ancestors_a, ancestors_b)
1075
1047
 
1076
1048
 
1077
1049
class _KnitComponentFile(object):