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

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from __future__ import absolute_import
20
20
 
21
 
from .lazy_import import lazy_import
 
21
from bzrlib.lazy_import import lazy_import
22
22
lazy_import(globals(), """
23
 
from breezy import (
 
23
from bzrlib import (
24
24
    annotate, # Must be lazy to avoid circular importing
25
25
    graph as _mod_graph,
26
26
    patiencediff,
27
27
    )
28
28
""")
29
 
from . import (
 
29
from bzrlib import (
30
30
    errors,
31
31
    osutils,
32
32
    ui,
33
33
    )
34
 
from .sixish import (
35
 
    range,
36
 
    viewitems,
37
 
    )
38
34
 
39
35
 
40
36
class Annotator(object):
74
70
        self._num_needed_children[key] = 1
75
71
        vf_keys_needed = set()
76
72
        ann_keys_needed = set()
77
 
        needed_keys = {key}
 
73
        needed_keys = set([key])
78
74
        while needed_keys:
79
75
            parent_lookup = []
80
76
            next_parent_map = {}
93
89
                    vf_keys_needed.add(key)
94
90
            needed_keys = set()
95
91
            next_parent_map.update(self._vf.get_parent_map(parent_lookup))
96
 
            for key, parent_keys in viewitems(next_parent_map):
 
92
            for key, parent_keys in next_parent_map.iteritems():
97
93
                if parent_keys is None: # No graph versionedfile
98
94
                    parent_keys = ()
99
95
                    next_parent_map[key] = ()
187
183
            par_sub = parent_annotations[parent_idx:parent_idx + match_len]
188
184
            if ann_sub == par_sub:
189
185
                continue
190
 
            for idx in range(match_len):
 
186
            for idx in xrange(match_len):
191
187
                ann = ann_sub[idx]
192
188
                par_ann = par_sub[idx]
193
189
                ann_idx = lines_idx + idx
261
257
                        each key is a possible source for the given line.
262
258
            lines the text of "key" as a list of lines
263
259
        """
264
 
        with ui.ui_factory.nested_progress_bar() as pb:
 
260
        pb = ui.ui_factory.nested_progress_bar()
 
261
        try:
265
262
            for text_key, text, num_lines in self._get_needed_texts(key, pb=pb):
266
263
                self._annotate_one(text_key, text, num_lines)
 
264
        finally:
 
265
            pb.finished()
267
266
        try:
268
267
            annotations = self._annotations_cache[key]
269
268
        except KeyError:
282
281
            # Backwards compatibility, break up the heads into pairs and
283
282
            # resolve the result
284
283
            next_head = iter(the_heads)
285
 
            head = next(next_head)
 
284
            head = next_head.next()
286
285
            for possible_head in next_head:
287
286
                annotated_lines = ((head, line), (possible_head, line))
288
287
                head = tiebreaker(annotated_lines)[0]