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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-02-14 03:16:54 UTC
  • mfrom: (7479.2.3 no-more-python2)
  • Revision ID: breezy.the.bot@gmail.com-20200214031654-bp1xtv2jr9nmhto3
Drop python2 support.

Merged from https://code.launchpad.net/~jelmer/brz/no-more-python2/+merge/378694

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    osutils,
42
42
    trace,
43
43
    )
44
 
from .sixish import (
45
 
    text_type,
46
 
    viewitems,
47
 
    )
48
44
 
49
45
 
50
46
FP_MTIME_COLUMN = 1
97
93
            parameters and returns a stack of ContentFilters.
98
94
            If None, no content filtering is performed.
99
95
        """
100
 
        if not isinstance(root, text_type):
 
96
        if not isinstance(root, str):
101
97
            raise ValueError("Base dir for hashcache must be text")
102
98
        self.root = root
103
99
        self.hit_count = 0
131
127
        # Stat in inode order as optimisation for at least linux.
132
128
        def inode_order(path_and_cache):
133
129
            return path_and_cache[1][1][3]
134
 
        for path, cache_val in sorted(viewitems(self._cache), key=inode_order):
 
130
        for path, cache_val in sorted(self._cache.items(), key=inode_order):
135
131
            abspath = osutils.pathjoin(self.root, path)
136
132
            fp = self._fingerprint(abspath)
137
133
            self.stat_count += 1
223
219
                                   new_mode=self._mode) as outf:
224
220
            outf.write(CACHE_HEADER)
225
221
 
226
 
            for path, c in viewitems(self._cache):
 
222
            for path, c in self._cache.items():
227
223
                line_info = [path.encode('utf-8'), b'// ', c[0], b' ']
228
224
                line_info.append(b'%d %d %d %d %d %d' % c[1])
229
225
                line_info.append(b'\n')