20
20
from cStringIO import StringIO
22
from bzrlib import branch, errors, lockdir, repository
23
from bzrlib.branch import BranchReferenceFormat
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)
108
assert False, 'unexpected response code %r' % (response,)
113
raise errors.UnexpectedSmartServerResponse(response)
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'
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)
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)
361
assert False, 'unexpected response code %s' % (response,)
370
raise errors.UnexpectedSmartServerResponse(response)
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)')
410
assert False, 'unexpected response code %s' % (response,)
419
raise errors.UnexpectedSmartServerResponse(response)
412
421
def unlock(self):
413
422
self._lock_count -= 1
524
533
return self._real_repository.control_weaves
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)
532
541
def get_inventory_weave(self):
835
849
elif response[0] == 'ReadOnlyError':
836
850
raise errors.ReadOnlyError(self)
838
assert False, 'unexpected response code %r' % (response,)
852
raise errors.UnexpectedSmartServerResponse(response)
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)')
888
assert False, 'unexpected response code %s' % (response,)
902
raise errors.UnexpectedSmartServerResponse(response)
890
904
def unlock(self):
891
905
self._lock_count -= 1
991
1005
return self._real_branch.append_revision(*revision_ids)
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,
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,
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)
1005
1027
def is_locked(self):
1006
1028
return self._lock_count >= 1