242
247
self.assertIs(None, tree.get_shelf_manager().last_shelf())
243
248
self.assertFileEqual(LINES_AJ, 'tree/foo')
251
def shelve_all(tree, target_revision_id):
254
target = tree.branch.repository.revision_tree(target_revision_id)
255
shelver = shelf_ui.Shelver(tree, target, auto=True,
261
def test_shelve_old_root_deleted(self):
262
tree1 = self.make_branch_and_tree('tree1')
263
tree1.commit('add root')
264
tree2 = self.make_branch_and_tree('tree2')
265
rev2 = tree2.commit('add root')
266
tree1.merge_from_branch(tree2.branch,
267
from_revision=revision.NULL_REVISION)
268
tree1.commit('Replaced root entry')
269
# This is essentially assertNotRaises(InconsistentDelta)
270
self.expectFailure('Cannot shelve replacing a root entry',
271
self.assertRaises, AssertionError,
272
self.assertRaises, errors.InconsistentDelta,
273
self.shelve_all, tree1, rev2)
275
def test_shelve_split(self):
276
outer_tree = self.make_branch_and_tree('outer')
277
outer_tree.commit('Add root')
278
inner_tree = self.make_branch_and_tree('outer/inner')
279
rev2 = inner_tree.commit('Add root')
280
outer_tree.subsume(inner_tree)
281
# This is essentially assertNotRaises(ValueError).
282
# The ValueError is 'None is not a valid file id'.
283
self.expectFailure('Cannot shelve a join back to the inner tree.',
284
self.assertRaises, AssertionError,
285
self.assertRaises, ValueError, self.shelve_all,
246
289
class TestApplyReporter(TestShelver):