/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-03 23:21:15 UTC
  • mfrom: (7290.42.6 paramiko-compat)
  • Revision ID: breezy.the.bot@gmail.com-20200203232115-g7k11bhsfeiqcprv
Fix compatibility with newer versions of paramiko, which break on noise before keys in pem files.

Merged from https://code.launchpad.net/~jelmer/brz/paramiko-compat/+merge/378480

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