39
44
from bzrlib.tests.per_interbranch import (
40
45
TestCaseWithInterBranch,
42
from bzrlib.transport import get_transport
43
from bzrlib.transport.local import LocalURLServer
47
from bzrlib.tests import test_server
46
50
# These tests are based on similar tests in
145
149
except (errors.IncompatibleFormat, errors.UninitializableFormat):
146
150
# This Branch format cannot create shared repositories
148
# This is a little bit trickier because make_branch_and_tree will not
152
# This is a little bit trickier because make_from_branch_and_tree will not
149
153
# re-use a shared repository.
151
155
a_branch = self.make_from_branch('repo/tree')
156
160
tree = a_branch.bzrdir.create_workingtree()
157
161
except errors.NotLocalUrl:
158
if self.vfs_transport_factory is LocalURLServer:
162
if self.vfs_transport_factory is test_server.LocalURLServer:
159
163
# the branch is colocated on disk, we cannot create a checkout.
160
164
# hopefully callers will expect this.
161
165
local_controldir = bzrdir.BzrDir.open(self.get_vfs_only_url('repo/tree'))
272
276
calls_after_insert_stream = hpss_call_names[insert_stream_idx:]
273
277
# After inserting the stream the client has no reason to query the
274
278
# remote graph any further.
276
['Repository.insert_stream_1.19', 'Repository.insert_stream_1.19',
277
'get', 'Branch.set_last_revision_info', 'Branch.unlock'],
278
calls_after_insert_stream)
279
bzr_core_trace = Equals(
280
['Repository.insert_stream_1.19', 'Repository.insert_stream_1.19',
281
'get', 'Branch.set_last_revision_info', 'Branch.unlock'])
282
bzr_loom_trace = Equals(
283
['Repository.insert_stream_1.19', 'Repository.insert_stream_1.19',
284
'get', 'Branch.set_last_revision_info', 'get', 'Branch.unlock'])
285
self.assertThat(calls_after_insert_stream,
286
MatchesAny(bzr_core_trace, bzr_loom_trace))
280
288
def disableOptimisticGetParentMap(self):
281
289
# Tweak some class variables to stop remote get_parent_map calls asking
282
290
# for or receiving more data than the caller asked for.
283
old_flag = SmartServerRepositoryGetParentMap.no_extra_results
284
inter_class = repository.InterRepository
285
old_batch_size = inter_class._walk_to_common_revisions_batch_size
286
inter_class._walk_to_common_revisions_batch_size = 1
287
SmartServerRepositoryGetParentMap.no_extra_results = True
289
SmartServerRepositoryGetParentMap.no_extra_results = old_flag
290
inter_class._walk_to_common_revisions_batch_size = old_batch_size
291
self.addCleanup(reset_values)
291
self.overrideAttr(repository.InterRepository,
292
'_walk_to_common_revisions_batch_size', 1)
293
self.overrideAttr(SmartServerRepositoryGetParentMap,
294
'no_extra_results', True)
294
297
class TestPushHook(TestCaseWithInterBranch):