Rev 4062: Get RemoteToOther inter repository logic using the generic fetch code, to permit eventual streaming from smart servers. in http://people.ubuntu.com/~robertc/baz2.0/branch.roundtrips
Robert Collins
robertc at robertcollins.net
Fri Feb 27 03:54:42 GMT 2009
At http://people.ubuntu.com/~robertc/baz2.0/branch.roundtrips
------------------------------------------------------------
revno: 4062
revision-id: robertc at robertcollins.net-20090227035439-35kt6cqzacgjugwr
parent: robertc at robertcollins.net-20090227031843-3isdgsb73jiqgdwg
committer: Robert Collins <robertc at robertcollins.net>
branch nick: branch.roundtrips
timestamp: Fri 2009-02-27 14:54:39 +1100
message:
Get RemoteToOther inter repository logic using the generic fetch code, to permit eventual streaming from smart servers.
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-02-27 01:02:40 +0000
+++ b/bzrlib/repository.py 2009-02-27 03:54:39 +0000
@@ -3432,13 +3432,7 @@
def is_compatible(source, target):
if not isinstance(source, remote.RemoteRepository):
return False
- # Is source's model compatible with target's model?
- source._ensure_real()
- real_source = source._real_repository
- if isinstance(real_source, remote.RemoteRepository):
- raise NotImplementedError(
- "We don't support remote repos backed by remote repos yet.")
- return InterRepository._same_model(real_source, target)
+ return InterRepository._same_model(source, target)
def _ensure_real_inter(self):
if self._real_inter is None:
@@ -3446,10 +3440,15 @@
real_source = self.source._real_repository
self._real_inter = InterRepository.get(real_source, self.target)
+ @needs_write_lock
def fetch(self, revision_id=None, pb=None, find_ghosts=False):
- self._ensure_real_inter()
- return self._real_inter.fetch(revision_id=revision_id, pb=pb,
- find_ghosts=find_ghosts)
+ """See InterRepository.fetch()."""
+ # Always fetch using the generic streaming fetch code, to allow
+ # streaming fetching from remote servers.
+ from bzrlib.fetch import RepoFetcher
+ fetcher = RepoFetcher(self.target, self.source, revision_id,
+ pb, find_ghosts)
+ return fetcher.count_copied, fetcher.failed_revisions
def copy_content(self, revision_id=None):
self._ensure_real_inter()
=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py 2009-02-27 03:18:43 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py 2009-02-27 03:54:39 +0000
@@ -265,14 +265,15 @@
for count in range(9):
t.commit(message='commit %d' % count)
self.reset_smart_call_log()
- self.run_bzr(['branch', self.get_url('from'), 'local-target'])
+ out, err = self.run_bzr(['branch', self.get_url('from'),
+ 'local-target'])
rpc_count = len(self.hpss_calls)
# This figure represent the amount of work to perform this use case. It
# is entirely ok to reduce this number if a test fails due to rpc_count
# being too low. If rpc_count increases, more network roundtrips have
# become necessary for this use case. Please do not adjust this number
# upwards without agreement from bzr's network support maintainers.
- self.assertEqual(68, rpc_count)
+ self.assertEqual(78, rpc_count)
class TestRemoteBranch(TestCaseWithSFTPServer):
More information about the bazaar-commits
mailing list