~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Martin Pool
  • Date: 2009-11-16 02:26:32 UTC
  • mto: This revision was merged to the branch mainline in revision 4880.
  • Revision ID: mbp@sourcefrog.net-20091116022632-261trs2osy8oupe3
Convert version-info to use TextUIOutputStream

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
 
115
115
        self._probe_bzrdir()
116
116
 
117
 
    def __repr__(self):
118
 
        return '%s(%r)' % (self.__class__.__name__, self._client)
119
 
 
120
117
    def _probe_bzrdir(self):
121
118
        medium = self._client._medium
122
119
        path = self._path_for_remote_call(self._client)
287
284
    def _get_branch_reference(self):
288
285
        path = self._path_for_remote_call(self._client)
289
286
        medium = self._client._medium
290
 
        candidate_calls = [
291
 
            ('BzrDir.open_branchV3', (2, 1)),
292
 
            ('BzrDir.open_branchV2', (1, 13)),
293
 
            ('BzrDir.open_branch', None),
294
 
            ]
295
 
        for verb, required_version in candidate_calls:
296
 
            if required_version and medium._is_remote_before(required_version):
297
 
                continue
 
287
        if not medium._is_remote_before((1, 13)):
298
288
            try:
299
 
                response = self._call(verb, path)
 
289
                response = self._call('BzrDir.open_branchV2', path)
 
290
                if response[0] not in ('ref', 'branch'):
 
291
                    raise errors.UnexpectedSmartServerResponse(response)
 
292
                return response
300
293
            except errors.UnknownSmartMethod:
301
 
                if required_version is None:
302
 
                    raise
303
 
                medium._remember_remote_is_before(required_version)
304
 
            else:
305
 
                break
306
 
        if verb == 'BzrDir.open_branch':
307
 
            if response[0] != 'ok':
308
 
                raise errors.UnexpectedSmartServerResponse(response)
309
 
            if response[1] != '':
310
 
                return ('ref', response[1])
311
 
            else:
312
 
                return ('branch', '')
313
 
        if response[0] not in ('ref', 'branch'):
 
294
                medium._remember_remote_is_before((1, 13))
 
295
        response = self._call('BzrDir.open_branch', path)
 
296
        if response[0] != 'ok':
314
297
            raise errors.UnexpectedSmartServerResponse(response)
315
 
        return response
 
298
        if response[1] != '':
 
299
            return ('ref', response[1])
 
300
        else:
 
301
            return ('branch', '')
316
302
 
317
303
    def _get_tree_branch(self):
318
304
        """See BzrDir._get_tree_branch()."""
615
601
        return self._custom_format._fetch_reconcile
616
602
 
617
603
    def get_format_description(self):
618
 
        self._ensure_real()
619
 
        return 'Remote: ' + self._custom_format.get_format_description()
 
604
        return 'bzr remote repository'
620
605
 
621
606
    def __eq__(self, other):
622
607
        return self.__class__ is other.__class__
965
950
    def is_write_locked(self):
966
951
        return self._lock_mode == 'w'
967
952
 
968
 
    def _warn_if_deprecated(self, branch=None):
969
 
        # If we have a real repository, the check will be done there, if we
970
 
        # don't the check will be done remotely.
971
 
        pass
972
 
 
973
953
    def lock_read(self):
974
954
        # wrong eventually - want a local lock cache context
975
955
        if not self._lock_mode:
1497
1477
        return self._real_repository.get_signature_text(revision_id)
1498
1478
 
1499
1479
    @needs_read_lock
1500
 
    def _get_inventory_xml(self, revision_id):
 
1480
    def get_inventory_xml(self, revision_id):
1501
1481
        self._ensure_real()
1502
 
        return self._real_repository._get_inventory_xml(revision_id)
 
1482
        return self._real_repository.get_inventory_xml(revision_id)
1503
1483
 
1504
 
    def _deserialise_inventory(self, revision_id, xml):
 
1484
    def deserialise_inventory(self, revision_id, xml):
1505
1485
        self._ensure_real()
1506
 
        return self._real_repository._deserialise_inventory(revision_id, xml)
 
1486
        return self._real_repository.deserialise_inventory(revision_id, xml)
1507
1487
 
1508
1488
    def reconcile(self, other=None, thorough=False):
1509
1489
        self._ensure_real()
2019
1999
                self._network_name)
2020
2000
 
2021
2001
    def get_format_description(self):
2022
 
        self._ensure_real()
2023
 
        return 'Remote: ' + self._custom_format.get_format_description()
 
2002
        return 'Remote BZR Branch'
2024
2003
 
2025
2004
    def network_name(self):
2026
2005
        return self._network_name
2837
2816
        raise NoSuchRevision(find('branch'), err.error_args[0])
2838
2817
    elif err.error_verb == 'nosuchrevision':
2839
2818
        raise NoSuchRevision(find('repository'), err.error_args[0])
2840
 
    elif err.error_verb == 'nobranch':
2841
 
        if len(err.error_args) >= 1:
2842
 
            extra = err.error_args[0]
2843
 
        else:
2844
 
            extra = None
2845
 
        raise errors.NotBranchError(path=find('bzrdir').root_transport.base,
2846
 
            detail=extra)
 
2819
    elif err.error_tuple == ('nobranch',):
 
2820
        raise errors.NotBranchError(path=find('bzrdir').root_transport.base)
2847
2821
    elif err.error_verb == 'norepository':
2848
2822
        raise errors.NoRepositoryPresent(find('bzrdir'))
2849
2823
    elif err.error_verb == 'LockContention':