/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-06-12 01:45:56 UTC
  • mfrom: (7513.1.2 pypy3)
  • Revision ID: breezy.the.bot@gmail.com-20200612014556-tsc8assk3d0luziu
Avoid deprecated behaviour in ElementTree.

Merged from https://code.launchpad.net/~jelmer/brz/pypy3/+merge/385611

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
# TODO: Up-front, stat all files in order and remove those which are deleted or
20
18
# out-of-date.  Don't actually re-read them until they're needed.  That ought
21
19
# to bring all the inodes into core so that future stats to them are fast, and
41
39
    osutils,
42
40
    trace,
43
41
    )
44
 
from .sixish import (
45
 
    text_type,
46
 
    viewitems,
47
 
    )
48
42
 
49
43
 
50
44
FP_MTIME_COLUMN = 1
97
91
            parameters and returns a stack of ContentFilters.
98
92
            If None, no content filtering is performed.
99
93
        """
100
 
        if not isinstance(root, text_type):
 
94
        if not isinstance(root, str):
101
95
            raise ValueError("Base dir for hashcache must be text")
102
96
        self.root = root
103
97
        self.hit_count = 0
131
125
        # Stat in inode order as optimisation for at least linux.
132
126
        def inode_order(path_and_cache):
133
127
            return path_and_cache[1][1][3]
134
 
        for path, cache_val in sorted(viewitems(self._cache), key=inode_order):
 
128
        for path, cache_val in sorted(self._cache.items(), key=inode_order):
135
129
            abspath = osutils.pathjoin(self.root, path)
136
130
            fp = self._fingerprint(abspath)
137
131
            self.stat_count += 1
223
217
                                   new_mode=self._mode) as outf:
224
218
            outf.write(CACHE_HEADER)
225
219
 
226
 
            for path, c in viewitems(self._cache):
 
220
            for path, c in self._cache.items():
227
221
                line_info = [path.encode('utf-8'), b'// ', c[0], b' ']
228
222
                line_info.append(b'%d %d %d %d %d %d' % c[1])
229
223
                line_info.append(b'\n')