/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 breezy/_annotator_py.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 01:35:53 UTC
  • mto: (6670.4.8 move-bzr)
  • mto: This revision was merged to the branch mainline in revision 6681.
  • Revision ID: jelmer@jelmer.uk-20170610013553-560y7mn3su4pp763
Fix remaining tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Functionality for doing annotations in the 'optimal' way"""
18
18
 
19
 
from bzrlib.lazy_import import lazy_import
 
19
from __future__ import absolute_import
 
20
 
 
21
from .lazy_import import lazy_import
20
22
lazy_import(globals(), """
21
 
from bzrlib import annotate # Must be lazy to avoid circular importing
 
23
from breezy import (
 
24
    annotate, # Must be lazy to avoid circular importing
 
25
    graph as _mod_graph,
 
26
    patiencediff,
 
27
    )
22
28
""")
23
 
from bzrlib import (
 
29
from . import (
24
30
    errors,
25
 
    graph as _mod_graph,
26
31
    osutils,
27
 
    patiencediff,
28
32
    ui,
29
33
    )
 
34
from .sixish import (
 
35
    range,
 
36
    viewitems,
 
37
    )
30
38
 
31
39
 
32
40
class Annotator(object):
66
74
        self._num_needed_children[key] = 1
67
75
        vf_keys_needed = set()
68
76
        ann_keys_needed = set()
69
 
        needed_keys = set([key])
 
77
        needed_keys = {key}
70
78
        while needed_keys:
71
79
            parent_lookup = []
72
80
            next_parent_map = {}
85
93
                    vf_keys_needed.add(key)
86
94
            needed_keys = set()
87
95
            next_parent_map.update(self._vf.get_parent_map(parent_lookup))
88
 
            for key, parent_keys in next_parent_map.iteritems():
 
96
            for key, parent_keys in viewitems(next_parent_map):
89
97
                if parent_keys is None: # No graph versionedfile
90
98
                    parent_keys = ()
91
99
                    next_parent_map[key] = ()
179
187
            par_sub = parent_annotations[parent_idx:parent_idx + match_len]
180
188
            if ann_sub == par_sub:
181
189
                continue
182
 
            for idx in xrange(match_len):
 
190
            for idx in range(match_len):
183
191
                ann = ann_sub[idx]
184
192
                par_ann = par_sub[idx]
185
193
                ann_idx = lines_idx + idx
277
285
            # Backwards compatibility, break up the heads into pairs and
278
286
            # resolve the result
279
287
            next_head = iter(the_heads)
280
 
            head = next_head.next()
 
288
            head = next(next_head)
281
289
            for possible_head in next_head:
282
290
                annotated_lines = ((head, line), (possible_head, line))
283
291
                head = tiebreaker(annotated_lines)[0]