231
231
trunk.push(remote_branch)
232
232
check.check_dwim(remote_branch.base, False, True, True)
234
def test_no_get_parent_map_after_insert_stream(self):
235
# Effort test for bug 331823
236
self.setup_smart_server_with_call_log()
237
# Make a local branch with four revisions. Four revisions because:
238
# one to push, one there for _walk_to_common_revisions to find, one we
239
# don't want to access, one for luck :)
240
if isinstance(self.branch_format, branch.BranchReferenceFormat):
241
# This test could in principle apply to BranchReferenceFormat, but
242
# make_branch_builder doesn't support it.
243
raise tests.TestSkipped(
244
"BranchBuilder can't make reference branches.")
246
builder = self.make_branch_builder('local')
247
except (errors.TransportNotPossible, errors.UninitializableFormat):
248
raise tests.TestNotApplicable('format not directly constructable')
249
builder.start_series()
250
builder.build_snapshot('first', None, [
251
('add', ('', 'root-id', 'directory', ''))])
252
builder.build_snapshot('second', ['first'], [])
253
builder.build_snapshot('third', ['second'], [])
254
builder.build_snapshot('fourth', ['third'], [])
255
builder.finish_series()
256
local = builder.get_branch()
257
local = branch.Branch.open(self.get_vfs_only_url('local'))
258
# Initial push of three revisions
259
remote_bzrdir = local.bzrdir.sprout(
260
self.get_url('remote'), revision_id='third')
261
remote = remote_bzrdir.open_branch()
262
# Push fourth revision
263
self.reset_smart_call_log()
264
self.disableOptimisticGetParentMap()
265
self.assertFalse(local.is_locked())
267
hpss_call_names = [item.call.method for item in self.hpss_calls]
268
self.assertTrue('Repository.insert_stream_1.19' in hpss_call_names)
269
insert_stream_idx = hpss_call_names.index(
270
'Repository.insert_stream_1.19')
271
calls_after_insert_stream = hpss_call_names[insert_stream_idx:]
272
# After inserting the stream the client has no reason to query the
273
# remote graph any further.
275
['Repository.insert_stream_1.19', 'Repository.insert_stream_1.19',
276
'get', 'Branch.set_last_revision_info', 'Branch.unlock'],
277
calls_after_insert_stream)
279
def disableOptimisticGetParentMap(self):
280
# Tweak some class variables to stop remote get_parent_map calls asking
281
# for or receiving more data than the caller asked for.
282
self.overrideAttr(repository.InterRepository,
283
'_walk_to_common_revisions_batch_size', 1)
284
self.overrideAttr(_mod_smart_repo.SmartServerRepositoryGetParentMap,
285
'no_extra_results', True)
288
235
class TestPushHook(per_branch.TestCaseWithBranch):