/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: Martin
  • Date: 2017-06-04 18:09:30 UTC
  • mto: This revision was merged to the branch mainline in revision 6653.
  • Revision ID: gzlist@googlemail.com-20170604180930-zpcenvzu13lilaax
Apply 2to3 xrange fix and fix up with sixish range

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
    )
30
37
 
31
38
 
32
39
class Annotator(object):
66
73
        self._num_needed_children[key] = 1
67
74
        vf_keys_needed = set()
68
75
        ann_keys_needed = set()
69
 
        needed_keys = set([key])
 
76
        needed_keys = {key}
70
77
        while needed_keys:
71
78
            parent_lookup = []
72
79
            next_parent_map = {}
179
186
            par_sub = parent_annotations[parent_idx:parent_idx + match_len]
180
187
            if ann_sub == par_sub:
181
188
                continue
182
 
            for idx in xrange(match_len):
 
189
            for idx in range(match_len):
183
190
                ann = ann_sub[idx]
184
191
                par_ann = par_sub[idx]
185
192
                ann_idx = lines_idx + idx
277
284
            # Backwards compatibility, break up the heads into pairs and
278
285
            # resolve the result
279
286
            next_head = iter(the_heads)
280
 
            head = next_head.next()
 
287
            head = next(next_head)
281
288
            for possible_head in next_head:
282
289
                annotated_lines = ((head, line), (possible_head, line))
283
290
                head = tiebreaker(annotated_lines)[0]