~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Jonathan Lange
  • Date: 2009-06-26 08:46:52 UTC
  • mto: (4484.1.1 bring-1.16.1-back)
  • mto: This revision was merged to the branch mainline in revision 4485.
  • Revision ID: jml@canonical.com-20090626084652-x7wn8yimd3fj0j0y
Tweak NEWS slightly based on mbp's feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    errors,
29
29
    graph,
30
30
    lockdir,
 
31
    pack,
31
32
    repository,
32
33
    revision,
33
34
    revision as _mod_revision,
34
35
    symbol_versioning,
 
36
    urlutils,
35
37
)
36
38
from bzrlib.branch import BranchReferenceFormat
37
39
from bzrlib.bzrdir import BzrDir, RemoteBzrDirFormat
678
680
        return self._real_repository.get_missing_parent_inventories(
679
681
            check_for_missing_texts=check_for_missing_texts)
680
682
 
681
 
    def _get_rev_id_for_revno_vfs(self, revno, known_pair):
682
 
        self._ensure_real()
683
 
        return self._real_repository.get_rev_id_for_revno(
684
 
            revno, known_pair)
685
 
 
686
 
    def get_rev_id_for_revno(self, revno, known_pair):
687
 
        """See Repository.get_rev_id_for_revno."""
688
 
        path = self.bzrdir._path_for_remote_call(self._client)
689
 
        try:
690
 
            if self._client._medium._is_remote_before((1, 17)):
691
 
                return self._get_rev_id_for_revno_vfs(revno, known_pair)
692
 
            response = self._call(
693
 
                'Repository.get_rev_id_for_revno', path, revno, known_pair)
694
 
        except errors.UnknownSmartMethod:
695
 
            self._client._medium._remember_remote_is_before((1, 17))
696
 
            return self._get_rev_id_for_revno_vfs(revno, known_pair)
697
 
        if response[0] == 'ok':
698
 
            return True, response[1]
699
 
        elif response[0] == 'history-incomplete':
700
 
            known_pair = response[1:3]
701
 
            for fallback in self._fallback_repositories:
702
 
                found, result = fallback.get_rev_id_for_revno(revno, known_pair)
703
 
                if found:
704
 
                    return True, result
705
 
                else:
706
 
                    known_pair = result
707
 
            # Not found in any fallbacks
708
 
            return False, known_pair
709
 
        else:
710
 
            raise errors.UnexpectedSmartServerResponse(response)
711
 
 
712
683
    def _ensure_real(self):
713
684
        """Ensure that there is a _real_repository set.
714
685
 
1929
1900
        self._ensure_real()
1930
1901
        return self._custom_format.supports_stacking()
1931
1902
 
1932
 
    def supports_set_append_revisions_only(self):
1933
 
        self._ensure_real()
1934
 
        return self._custom_format.supports_set_append_revisions_only()
1935
 
 
1936
1903
 
1937
1904
class RemoteBranch(branch.Branch, _RpcHelper):
1938
1905
    """Branch stored on a server accessed by HPSS RPC.
1957
1924
        # We intentionally don't call the parent class's __init__, because it
1958
1925
        # will try to assign to self.tags, which is a property in this subclass.
1959
1926
        # And the parent's __init__ doesn't do much anyway.
 
1927
        self._revision_id_to_revno_cache = None
 
1928
        self._partial_revision_id_to_revno_cache = {}
 
1929
        self._revision_history_cache = None
 
1930
        self._last_revision_info_cache = None
 
1931
        self._merge_sorted_revisions_cache = None
1960
1932
        self.bzrdir = remote_bzrdir
1961
1933
        if _client is not None:
1962
1934
            self._client = _client
1976
1948
        else:
1977
1949
            self._real_branch = None
1978
1950
        # Fill out expected attributes of branch for bzrlib API users.
1979
 
        self._clear_cached_state()
1980
1951
        self.base = self.bzrdir.root_transport.base
1981
1952
        self._control_files = None
1982
1953
        self._lock_mode = None
2263
2234
            raise NotImplementedError(self.dont_leave_lock_in_place)
2264
2235
        self._leave_lock = False
2265
2236
 
2266
 
    def get_rev_id(self, revno, history=None):
2267
 
        if revno == 0:
2268
 
            return _mod_revision.NULL_REVISION
2269
 
        last_revision_info = self.last_revision_info()
2270
 
        ok, result = self.repository.get_rev_id_for_revno(
2271
 
            revno, last_revision_info)
2272
 
        if ok:
2273
 
            return result
2274
 
        missing_parent = result[1]
2275
 
        # Either the revision named by the server is missing, or its parent
2276
 
        # is.  Call get_parent_map to determine which, so that we report a
2277
 
        # useful error.
2278
 
        parent_map = self.repository.get_parent_map([missing_parent])
2279
 
        if missing_parent in parent_map:
2280
 
            missing_parent = parent_map[missing_parent]
2281
 
        raise errors.RevisionNotPresent(missing_parent, self.repository)
2282
 
 
2283
2237
    def _last_revision_info(self):
2284
2238
        response = self._call('Branch.last_revision_info', self._remote_path())
2285
2239
        if response[0] != 'ok':