~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf.py

  • Committer: Robert Collins
  • Date: 2010-05-06 07:48:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506074822-0bsgf2j4h8jx0xkk
Added ``bzrlib.tests.matchers`` as a place to put matchers, along with
our first in-tree matcher. See the module docstring for details.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008-2011 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 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
 
 
649
626
 
650
627
class TestShelfManager(tests.TestCaseWithTransport):
651
628