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

  • Committer: John Arbash Meinel
  • Date: 2007-07-11 23:45:20 UTC
  • mfrom: (2601 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070711234520-do3h7zw8skbathpz
[merge] bzr.dev 2601

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from cStringIO import StringIO
21
21
 
22
 
from bzrlib import branch, errors, lockdir, repository
23
 
from bzrlib.branch import BranchReferenceFormat
 
22
from bzrlib import (
 
23
    branch,
 
24
    errors,
 
25
    lockdir,
 
26
    repository,
 
27
)
 
28
from bzrlib.branch import Branch, BranchReferenceFormat
24
29
from bzrlib.bzrdir import BzrDir, RemoteBzrDirFormat
25
30
from bzrlib.config import BranchConfig, TreeConfig
26
31
from bzrlib.decorators import needs_read_lock, needs_write_lock
105
110
        elif response == ('nobranch',):
106
111
            raise errors.NotBranchError(path=self.root_transport.base)
107
112
        else:
108
 
            assert False, 'unexpected response code %r' % (response,)
 
113
            raise errors.UnexpectedSmartServerResponse(response)
109
114
 
110
115
    def open_branch(self, _unsupported=False):
111
116
        assert _unsupported == False, 'unsupported flag support not implemented yet.'
294
299
        assert response[0] in ('yes', 'no'), 'unexpected response code %s' % (response,)
295
300
        return response[0] == 'yes'
296
301
 
 
302
    def get_graph(self, other_repository=None):
 
303
        """Return the graph for this repository format"""
 
304
        return self._real_repository.get_graph(other_repository)
 
305
 
297
306
    def gather_stats(self, revid=None, committers=None):
298
307
        """See Repository.gather_stats()."""
299
308
        path = self.bzrdir._path_for_remote_call(self._client)
358
367
        elif response[0] == 'UnlockableTransport':
359
368
            raise errors.UnlockableTransport(self.bzrdir.root_transport)
360
369
        else:
361
 
            assert False, 'unexpected response code %s' % (response,)
 
370
            raise errors.UnexpectedSmartServerResponse(response)
362
371
 
363
372
    def lock_write(self, token=None):
364
373
        if not self._lock_mode:
407
416
        elif response[0] == 'TokenMismatch':
408
417
            raise errors.TokenMismatch(token, '(remote token)')
409
418
        else:
410
 
            assert False, 'unexpected response code %s' % (response,)
 
419
            raise errors.UnexpectedSmartServerResponse(response)
411
420
 
412
421
    def unlock(self):
413
422
        self._lock_count -= 1
524
533
        return self._real_repository.control_weaves
525
534
 
526
535
    @needs_read_lock
527
 
    def get_ancestry(self, revision_id):
 
536
    def get_ancestry(self, revision_id, topo_sorted=True):
528
537
        self._ensure_real()
529
 
        return self._real_repository.get_ancestry(revision_id)
 
538
        return self._real_repository.get_ancestry(revision_id, topo_sorted)
530
539
 
531
540
    @needs_read_lock
532
541
    def get_inventory_weave(self):
764
773
        self._lock_count = 0
765
774
        self._leave_lock = False
766
775
 
 
776
    def __str__(self):
 
777
        return "%s(%s)" % (self.__class__.__name__, self.base)
 
778
 
 
779
    __repr__ = __str__
 
780
 
767
781
    def _ensure_real(self):
768
782
        """Ensure that there is a _real_branch set.
769
783
 
835
849
        elif response[0] == 'ReadOnlyError':
836
850
            raise errors.ReadOnlyError(self)
837
851
        else:
838
 
            assert False, 'unexpected response code %r' % (response,)
 
852
            raise errors.UnexpectedSmartServerResponse(response)
839
853
            
840
854
    def lock_write(self, token=None):
841
855
        if not self._lock_mode:
885
899
            raise errors.TokenMismatch(
886
900
                str((branch_token, repo_token)), '(remote tokens)')
887
901
        else:
888
 
            assert False, 'unexpected response code %s' % (response,)
 
902
            raise errors.UnexpectedSmartServerResponse(response)
889
903
 
890
904
    def unlock(self):
891
905
        self._lock_count -= 1
991
1005
        return self._real_branch.append_revision(*revision_ids)
992
1006
 
993
1007
    @needs_write_lock
994
 
    def pull(self, source, overwrite=False, stop_revision=None):
 
1008
    def pull(self, source, overwrite=False, stop_revision=None,
 
1009
             **kwargs):
 
1010
        # FIXME: This asks the real branch to run the hooks, which means
 
1011
        # they're called with the wrong target branch parameter. 
 
1012
        # The test suite specifically allows this at present but it should be
 
1013
        # fixed.  It should get a _override_hook_target branch,
 
1014
        # as push does.  -- mbp 20070405
995
1015
        self._ensure_real()
996
1016
        self._real_branch.pull(
997
 
            source, overwrite=overwrite, stop_revision=stop_revision)
 
1017
            source, overwrite=overwrite, stop_revision=stop_revision,
 
1018
            **kwargs)
998
1019
 
999
1020
    @needs_read_lock
1000
1021
    def push(self, target, overwrite=False, stop_revision=None):
1001
1022
        self._ensure_real()
1002
1023
        return self._real_branch.push(
1003
 
            target, overwrite=overwrite, stop_revision=stop_revision)
 
1024
            target, overwrite=overwrite, stop_revision=stop_revision,
 
1025
            _override_hook_source_branch=self)
1004
1026
 
1005
1027
    def is_locked(self):
1006
1028
        return self._lock_count >= 1