~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-05 19:10:42 UTC
  • mto: (0.15.1 unshelve)
  • mto: This revision was merged to the branch mainline in revision 3820.
  • Revision ID: aaron@aaronbentley.com-20081005191042-go1c5kln21yw47ie
Implement shelving content

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        shelf_bar = creator.shelf_transform.trans_id_file_id('bar-id')
57
57
        self.assertEqual(shelf_bar, creator.shelf_transform.final_parent(
58
58
                         shelf_trans_id))
 
59
        creator.transform()
 
60
        self.assertEqual('foo/baz', tree.id2path('baz-id'))
 
61
 
 
62
    def test_shelve_content_change(self):
 
63
        tree = self.make_branch_and_tree('.')
 
64
        tree.lock_write()
 
65
        self.addCleanup(tree.unlock)
 
66
        self.build_tree_contents([('foo', 'a\n')])
 
67
        tree.add('foo', 'foo-id')
 
68
        tree.commit('Committed foo')
 
69
        self.build_tree_contents([('foo', 'b\na\nc\n')])
 
70
        creator = prepare_shelf.ShelfCreator(tree)
 
71
        self.addCleanup(creator.finalize)
 
72
        self.assertEqual([('modify text', 'foo-id')], list(creator))
 
73
        creator.shelve_text('foo-id', 'a\nc\n')
 
74
        creator.transform()
 
75
        self.assertFileEqual('a\nc\n', 'foo')
 
76
        s_trans_id = creator.shelf_transform.trans_id_file_id('foo-id')
 
77
        shelf_file = creator.shelf_transform._limbo_name(s_trans_id)
 
78
        self.assertFileEqual('b\na\n', shelf_file)