350
350
self.assertContainsRe(err,
351
351
'Using default stacking branch stack_on at .*')
353
def test_push_doesnt_create_broken_branch(self):
354
"""Pushing a new standalone branch works even when there's a default
355
stacking policy at the destination.
357
The new branch will preserve the repo format (even if it isn't the
358
default for the branch), and will be stacked when the repo format
359
allows (which means that the branch format isn't necessarly preserved).
361
self.make_repository('repo', shared=True, format='1.6')
362
builder = self.make_branch_builder('repo/local', format='pack-0.92')
363
builder.start_series()
364
builder.build_snapshot('rev-1', None, [
365
('add', ('', 'root-id', 'directory', '')),
366
('add', ('filename', 'f-id', 'file', 'content\n'))])
367
builder.build_snapshot('rev-2', ['rev-1'], [])
368
builder.build_snapshot('rev-3', ['rev-2'],
369
[('modify', ('f-id', 'new-content\n'))])
370
builder.finish_series()
371
branch = builder.get_branch()
372
# Push rev-1 to "trunk", so that we can stack on it.
373
self.run_bzr('push -d repo/local trunk -r 1')
374
# Set a default stacking policy so that new branches will automatically
376
self.make_bzrdir('.').get_config().set_default_stack_on('trunk')
377
# Push rev-2 to a new branch "remote". It will be stacked on "trunk".
378
out, err = self.run_bzr('push -d repo/local remote -r 2')
379
self.assertContainsRe(
380
err, 'Using default stacking branch trunk at .*')
381
# Push rev-3 onto "remote". If "remote" not stacked and is missing the
382
# fulltext record for f-id @ rev-1, then this will fail.
383
out, err = self.run_bzr('push -d repo/local remote -r 3')
354
386
class RedirectingMemoryTransport(MemoryTransport):