~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf.py

  • Committer: John Arbash Meinel
  • Date: 2011-01-12 21:28:39 UTC
  • mfrom: (5602 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5605.
  • Revision ID: john@arbash-meinel.com-20110112212839-lfzo8o183tw10gnd
Merge bzr.dev 5602 to, yet again, resolve a NEWS/bzr-2.3.txt conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008-2011 Canonical Ltd
2
2
#
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
623
623
                              shelf_file)
624
624
        self.assertEqual('Shelf corrupt.', str(e))
625
625
 
 
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')
 
640
        tree.remove(['dir'])
 
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'))
 
648
 
626
649
 
627
650
class TestShelfManager(tests.TestCaseWithTransport):
628
651