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

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
# created, but it's not for now.
30
30
ROOT_ID = "TREE_ROOT"
31
31
 
32
 
from breezy.lazy_import import lazy_import
 
32
from .lazy_import import lazy_import
33
33
lazy_import(globals(), """
34
34
import collections
35
35
import copy
44
44
    )
45
45
""")
46
46
 
47
 
from breezy import (
 
47
from . import (
48
48
    lazy_regex,
49
49
    trace,
50
50
    )
51
51
 
52
 
from breezy.static_tuple import StaticTuple
53
 
from breezy.symbol_versioning import (
 
52
from .static_tuple import StaticTuple
 
53
from .symbol_versioning import (
54
54
    deprecated_in,
55
55
    deprecated_method,
56
56
    )
669
669
 
670
670
        # unrolling the recursive called changed the time from
671
671
        # 440ms/663ms (inline/total) to 116ms/116ms
672
 
        children = from_dir.children.items()
673
 
        children.sort()
 
672
        children = sorted(from_dir.children.items())
674
673
        if not recursive:
675
674
            for name, ie in children:
676
675
                yield name, ie
695
694
                    continue
696
695
 
697
696
                # But do this child first
698
 
                new_children = ie.children.items()
699
 
                new_children.sort()
 
697
                new_children = sorted(ie.children.items())
700
698
                new_children = collections.deque(new_children)
701
699
                stack.append((path, new_children))
702
700
                # Break out of inner loop, so that we start outer loop with child
820
818
        """
821
819
        accum = []
822
820
        def descend(dir_ie, dir_path):
823
 
            kids = dir_ie.children.items()
824
 
            kids.sort()
 
821
            kids = sorted(dir_ie.children.items())
825
822
            for name, ie in kids:
826
823
                child_path = osutils.pathjoin(dir_path, name)
827
824
                accum.append((child_path, ie))
1487
1484
            keys = [StaticTuple(f,).intern() for f in directories_to_expand]
1488
1485
            directories_to_expand = set()
1489
1486
            items = self.parent_id_basename_to_file_id.iteritems(keys)
1490
 
            next_file_ids = set([item[1] for item in items])
 
1487
            next_file_ids = {item[1] for item in items}
1491
1488
            next_file_ids = next_file_ids.difference(interesting)
1492
1489
            interesting.update(next_file_ids)
1493
1490
            for entry in self._getitems(next_file_ids):
2070
2067
 
2071
2068
    def _make_delta(self, old):
2072
2069
        """Make an inventory delta from two inventories."""
2073
 
        if type(old) != CHKInventory:
 
2070
        if not isinstance(old, CHKInventory):
2074
2071
            return CommonInventory._make_delta(self, old)
2075
2072
        delta = []
2076
2073
        for key, old_value, self_value in \
2319
2316
        if item[2] is None:
2320
2317
            raise errors.InconsistentDelta(item[0] or item[1], item[2],
2321
2318
                "entry with file_id None %r" % entry)
2322
 
        if type(item[2]) != str:
 
2319
        if not isinstance(item[2], str):
2323
2320
            raise errors.InconsistentDelta(item[0] or item[1], item[2],
2324
2321
                "entry with non bytes file_id %r" % entry)
2325
2322
        yield item