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

  • Committer: Jelmer Vernooij
  • Date: 2017-02-06 00:15:01 UTC
  • mto: (6621.2.2 py3)
  • mto: This revision was merged to the branch mainline in revision 6624.
  • Revision ID: jelmer@jelmer.uk-20170206001501-e44n1mbowv58ohx8
Keep __nonzero__ around for Python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005-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
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
 
17
19
# TODO: Up-front, stat all files in order and remove those which are deleted or
18
20
# out-of-date.  Don't actually re-read them until they're needed.  That ought
19
21
# to bring all the inodes into core so that future stats to them are fast, and
125
127
        """
126
128
        # FIXME optimisation opportunity, on linux [and check other oses]:
127
129
        # rather than iteritems order, stat in inode order.
128
 
        prep = [(ce[1][3], path, ce) for (path, ce) in self._cache.iteritems()]
129
 
        prep.sort()
 
130
        prep = sorted([(ce[1][3], path, ce) for (path, ce) in self._cache.iteritems()])
130
131
 
131
132
        for inum, path, cache_entry in prep:
132
133
            abspath = osutils.pathjoin(self.root, path)
254
255
        fn = self.cache_file_name()
255
256
        try:
256
257
            inf = file(fn, 'rb', buffering=65000)
257
 
        except IOError, e:
 
258
        except IOError as e:
258
259
            trace.mutter("failed to open %s: %s", fn, e)
259
260
            # better write it now so it is valid
260
261
            self.needs_write = True
289
290
 
290
291
            self._cache[path] = (sha1, fp)
291
292
 
 
293
        # GZ 2009-09-20: Should really use a try/finally block to ensure close
 
294
        inf.close()
 
295
 
292
296
        self.needs_write = False
293
297
 
294
298
    def _cutoff_time(self):