20
20
from cStringIO import StringIO
28
from bzrlib.branch import Branch, BranchReferenceFormat
22
from bzrlib import branch, errors, lockdir, repository
23
from bzrlib.branch import BranchReferenceFormat
29
24
from bzrlib.bzrdir import BzrDir, RemoteBzrDirFormat
30
25
from bzrlib.config import BranchConfig, TreeConfig
31
26
from bzrlib.decorators import needs_read_lock, needs_write_lock
110
105
elif response == ('nobranch',):
111
106
raise errors.NotBranchError(path=self.root_transport.base)
113
raise errors.UnexpectedSmartServerResponse(response)
108
assert False, 'unexpected response code %r' % (response,)
115
110
def open_branch(self, _unsupported=False):
116
111
assert _unsupported == False, 'unsupported flag support not implemented yet.'
299
294
assert response[0] in ('yes', 'no'), 'unexpected response code %s' % (response,)
300
295
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)
306
297
def gather_stats(self, revid=None, committers=None):
307
298
"""See Repository.gather_stats()."""
308
299
path = self.bzrdir._path_for_remote_call(self._client)
367
358
elif response[0] == 'UnlockableTransport':
368
359
raise errors.UnlockableTransport(self.bzrdir.root_transport)
370
raise errors.UnexpectedSmartServerResponse(response)
361
assert False, 'unexpected response code %s' % (response,)
372
363
def lock_write(self, token=None):
373
364
if not self._lock_mode:
416
407
elif response[0] == 'TokenMismatch':
417
408
raise errors.TokenMismatch(token, '(remote token)')
419
raise errors.UnexpectedSmartServerResponse(response)
410
assert False, 'unexpected response code %s' % (response,)
421
412
def unlock(self):
422
413
self._lock_count -= 1
533
524
return self._real_repository.control_weaves
536
def get_ancestry(self, revision_id, topo_sorted=True):
527
def get_ancestry(self, revision_id):
537
528
self._ensure_real()
538
return self._real_repository.get_ancestry(revision_id, topo_sorted)
529
return self._real_repository.get_ancestry(revision_id)
541
532
def get_inventory_weave(self):
849
835
elif response[0] == 'ReadOnlyError':
850
836
raise errors.ReadOnlyError(self)
852
raise errors.UnexpectedSmartServerResponse(response)
838
assert False, 'unexpected response code %r' % (response,)
854
840
def lock_write(self, token=None):
855
841
if not self._lock_mode:
899
885
raise errors.TokenMismatch(
900
886
str((branch_token, repo_token)), '(remote tokens)')
902
raise errors.UnexpectedSmartServerResponse(response)
888
assert False, 'unexpected response code %s' % (response,)
904
890
def unlock(self):
905
891
self._lock_count -= 1
1005
991
return self._real_branch.append_revision(*revision_ids)
1007
993
@needs_write_lock
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
994
def pull(self, source, overwrite=False, stop_revision=None):
1015
995
self._ensure_real()
1016
996
self._real_branch.pull(
1017
source, overwrite=overwrite, stop_revision=stop_revision,
997
source, overwrite=overwrite, stop_revision=stop_revision)
1020
999
@needs_read_lock
1021
1000
def push(self, target, overwrite=False, stop_revision=None):
1022
1001
self._ensure_real()
1023
1002
return self._real_branch.push(
1024
target, overwrite=overwrite, stop_revision=stop_revision,
1025
_override_hook_source_branch=self)
1003
target, overwrite=overwrite, stop_revision=stop_revision)
1027
1005
def is_locked(self):
1028
1006
return self._lock_count >= 1