~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tests/test_prepare_shelf.py

  • Committer: Aaron Bentley
  • Date: 2008-10-06 04:52:17 UTC
  • mto: (0.15.1 unshelve)
  • mto: This revision was merged to the branch mainline in revision 3820.
  • Revision ID: aaron@aaronbentley.com-20081006045217-yi5u5side31o7rlp
Handle shelving directory creation

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
        tree.lock_write()
86
86
        self.addCleanup(tree.unlock)
87
87
        tree.commit('Empty tree')
88
 
        self.build_tree_contents([('foo', 'a\n')])
89
 
        tree.add('foo', 'foo-id')
 
88
        self.build_tree_contents([('foo', 'a\n'), ('bar/',)])
 
89
        tree.add(['foo', 'bar'], ['foo-id', 'bar-id'])
90
90
        creator = prepare_shelf.ShelfCreator(tree)
91
91
        self.addCleanup(creator.finalize)
92
 
        self.assertEqual([('add file', 'foo-id', 'file')], list(creator))
 
92
        self.assertEqual([('add file', 'bar-id', 'directory'),
 
93
                          ('add file', 'foo-id', 'file')],
 
94
                          sorted(list(creator)))
93
95
        creator.shelve_creation('foo-id', 'file')
 
96
        creator.shelve_creation('bar-id', 'directory')
94
97
        creator.transform()
95
98
        self.assertRaises(StopIteration,
96
99
                          tree.iter_entries_by_dir(['foo-id']).next)
98
101
        self.assertEqual('foo-id',
99
102
                         creator.shelf_transform.final_file_id(s_trans_id))
100
103
        self.failIfExists('foo')
 
104
        self.failIfExists('bar')
101
105
        self.assertShelvedFileEqual('a\n', creator, 'foo-id')
 
106
        s_bar_trans_id = creator.shelf_transform.trans_id_file_id('bar-id')
 
107
        self.assertEqual('directory',
 
108
            creator.shelf_transform.final_kind(s_bar_trans_id))