1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
1
# Copyright (C) 2008-2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
624
624
self.assertEqual('Shelf corrupt.', str(e))
626
def test_unshelve_subdir_in_now_removed_dir(self):
627
tree = self.make_branch_and_tree('.')
628
self.addCleanup(tree.lock_write().unlock)
629
self.build_tree(['dir/', 'dir/subdir/', 'dir/subdir/foo'])
630
tree.add(['dir'], ['dir-id'])
631
tree.commit('versioned dir')
632
tree.add(['dir/subdir', 'dir/subdir/foo'], ['subdir-id', 'foo-id'])
633
creator = shelf.ShelfCreator(tree, tree.basis_tree())
634
self.addCleanup(creator.finalize)
635
for change in creator.iter_shelvable():
636
creator.shelve_change(change)
637
shelf_manager = tree.get_shelf_manager()
638
shelf_id = shelf_manager.shelve_changes(creator)
639
self.failIfExists('dir/subdir')
641
unshelver = shelf_manager.get_unshelver(shelf_id)
642
self.addCleanup(unshelver.finalize)
643
unshelver.make_merger().do_merge()
644
self.failUnlessExists('dir/subdir/foo')
645
self.assertEqual('dir-id', tree.path2id('dir'))
646
self.assertEqual('subdir-id', tree.path2id('dir/subdir'))
647
self.assertEqual('foo-id', tree.path2id('dir/subdir/foo'))
627
650
class TestShelfManager(tests.TestCaseWithTransport):