/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/remote.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 00:06:46 UTC
  • mfrom: (6673 work)
  • mto: This revision was merged to the branch mainline in revision 6675.
  • Revision ID: jelmer@jelmer.uk-20170610000646-xj6jh277lo4xuo10
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from . import (
23
23
    bencode,
24
24
    branch,
 
25
    bzrbranch,
25
26
    bzrdir as _mod_bzrdir,
26
27
    config as _mod_config,
27
28
    controldir,
42
43
    vf_repository,
43
44
    vf_search,
44
45
    )
45
 
from .branch import BranchReferenceFormat, BranchWriteLockResult
 
46
from .bzrbranch import BranchReferenceFormat
 
47
from .branch import BranchWriteLockResult
46
48
from .decorators import needs_read_lock, needs_write_lock, only_raises
47
49
from .errors import (
48
50
    NoSuchRevision,
51
53
from .i18n import gettext
52
54
from .inventory import Inventory
53
55
from .lockable_files import LockableFiles
 
56
from .sixish import (
 
57
    viewitems,
 
58
    viewvalues,
 
59
    )
54
60
from .smart import client, vfs, repository as smart_repo
55
61
from .smart.client import _SmartClient
56
62
from .revision import NULL_REVISION
698
704
            raise errors.UnexpectedSmartServerResponse(response)
699
705
        body = bencode.bdecode(handler.read_body_bytes())
700
706
        ret = {}
701
 
        for (name, value) in body.iteritems():
 
707
        for name, value in viewitems(body):
702
708
            ret[name] = self._open_branch(name, value[0], value[1],
703
709
                possible_transports=possible_transports,
704
710
                ignore_fallbacks=ignore_fallbacks)
2088
2094
    def revision_ids_to_search_result(self, result_set):
2089
2095
        """Convert a set of revision ids to a graph SearchResult."""
2090
2096
        result_parents = set()
2091
 
        for parents in self.get_graph().get_parent_map(
2092
 
            result_set).itervalues():
 
2097
        for parents in viewvalues(self.get_graph().get_parent_map(result_set)):
2093
2098
            result_parents.update(parents)
2094
2099
        included_keys = result_set.intersection(result_parents)
2095
2100
        start_keys = result_set.difference(included_keys)
2214
2219
            for fallback in self._fallback_repositories:
2215
2220
                if not absent:
2216
2221
                    break
2217
 
                desired_files = [(key[0], key[1], identifier) for
2218
 
                    (identifier, key) in absent.iteritems()]
 
2222
                desired_files = [(key[0], key[1], identifier)
 
2223
                    for identifier, key in viewitems(absent)]
2219
2224
                for (identifier, bytes_iterator) in fallback.iter_files_bytes(desired_files):
2220
2225
                    del absent[identifier]
2221
2226
                    yield identifier, bytes_iterator
2222
2227
            if absent:
2223
2228
                # There may be more missing items, but raise an exception
2224
2229
                # for just one.
2225
 
                missing_identifier = absent.keys()[0]
 
2230
                missing_identifier = next(iter(absent))
2226
2231
                missing_key = absent[missing_identifier]
2227
2232
                raise errors.RevisionNotPresent(revision_id=missing_key[1],
2228
2233
                    file_id=missing_key[0])
2262
2267
            # There is one other "bug" which is that ghosts in
2263
2268
            # get_revision_graph() are not returned at all. But we won't worry
2264
2269
            # about that for now.
2265
 
            for node_id, parent_ids in rg.iteritems():
 
2270
            for node_id, parent_ids in viewitems(rg):
2266
2271
                if parent_ids == ():
2267
2272
                    rg[node_id] = (NULL_REVISION,)
2268
2273
            rg[NULL_REVISION] = ()
3224
3229
        # usually cheaper in terms of net round trips, as the last-revision and
3225
3230
        # tags info fetched is cached and would be fetched anyway.
3226
3231
        self._ensure_real()
3227
 
        if isinstance(self._custom_format, branch.BranchFormatMetadir):
 
3232
        if isinstance(self._custom_format, bzrbranch.BranchFormatMetadir):
3228
3233
            branch_class = self._custom_format._branch_class()
3229
3234
            heads_to_fetch_impl = branch_class.heads_to_fetch.__func__
3230
3235
            if heads_to_fetch_impl is branch.Branch.heads_to_fetch.__func__: