/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

Support user.signingkey configuration variable in .git/config.

Merged from https://code.launchpad.net/~jelmer/brz/local-git-key/+merge/381000

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