/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/git/cache.py

  • Committer: Jelmer Vernooij
  • Date: 2020-03-22 20:02:36 UTC
  • mto: (7490.7.7 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200322200236-fsbl91ktcn6fcbdd
Fix tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Map from Git sha's to Bazaar objects."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from dulwich.objects import (
20
22
    sha_to_hex,
21
23
    hex_to_sha,
39
41
    index as _mod_index,
40
42
    versionedfile,
41
43
    )
 
44
from ..sixish import (
 
45
    viewitems,
 
46
    viewkeys,
 
47
    viewvalues,
 
48
    )
42
49
from ..transport import (
43
50
    get_transport_from_path,
44
51
    )
329
336
    def lookup_git_sha(self, sha):
330
337
        if not isinstance(sha, bytes):
331
338
            raise TypeError(sha)
332
 
        for entry in self._by_sha[sha].values():
 
339
        for entry in viewvalues(self._by_sha[sha]):
333
340
            yield entry
334
341
 
335
342
    def lookup_tree_id(self, fileid, revision):
339
346
        return self._by_revid[revid]
340
347
 
341
348
    def revids(self):
342
 
        for key, entries in self._by_sha.items():
343
 
            for (type, type_data) in entries.values():
 
349
        for key, entries in viewitems(self._by_sha):
 
350
            for (type, type_data) in viewvalues(entries):
344
351
                if type == "commit":
345
352
                    yield type_data[0]
346
353
 
347
354
    def sha1s(self):
348
 
        return self._by_sha.keys()
 
355
        return viewkeys(self._by_sha)
349
356
 
350
357
 
351
358
class SqliteCacheUpdater(CacheUpdater):
704
711
        return ret
705
712
 
706
713
    def _keys(self):
707
 
        return self.db.keys()
 
714
        try:
 
715
            return self.db.keys()
 
716
        except AttributeError:  # python < 3
 
717
            return self.db.iterkeys()
708
718
 
709
719
    def revids(self):
710
720
        """List the revision ids known."""