294
294
self.assertEqual('a-id', basis.path2id('a'))
295
295
self.assertEqual('b-id', basis.path2id('b'))
297
def test_set_parent_trees_handles_missing_basis(self):
298
builder = self.make_branch_builder('source')
299
builder.start_series()
300
self.addCleanup(builder.finish_series)
301
builder.build_snapshot('A', [], [
302
('add', ('', 'root-id', 'directory', None)),
303
('add', ('a', 'a-id', 'file', 'content\n'))])
304
builder.build_snapshot('B', ['A'], [
305
('modify', ('a-id', 'new content\nfor a\n')),
306
('add', ('b', 'b-id', 'file', 'b-content\n'))])
307
builder.build_snapshot('C', ['A'], [
308
('add', ('c', 'c-id', 'file', 'c-content\n'))])
309
b_c = self.make_branch('branch_with_c')
310
b_c.pull(builder.get_branch(), stop_revision='C')
311
b_b = self.make_branch('branch_with_b')
312
b_b.pull(builder.get_branch(), stop_revision='B')
313
# This is reproducing some of what 'switch' does, just to isolate the
314
# set_parent_trees() step.
315
wt = b_b.create_checkout('tree', lightweight=True)
316
fmt = wt.bzrdir.find_branch_format()
317
fmt.set_reference(wt.bzrdir, None, b_c)
318
# Re-open with the new reference
319
wt = wt.bzrdir.open_workingtree()
320
wt.set_parent_trees([('C', b_c.repository.revision_tree('C'))])
321
self.assertEqual(None, wt.basis_tree().path2id('b'))
297
323
def test_new_dirstate_on_new_lock(self):
298
324
# until we have detection for when a dirstate can be reused, we
299
325
# want to reparse dirstate on every new lock.