~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf.py

(jam) Fix bug #504390 and root-id handling for update and pull

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 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
108
108
        creator.shelve_change(('rename', 'baz-id', 'foo/baz', 'bar/baz'))
109
109
        self.check_shelve_move(creator, tree)
110
110
 
 
111
    def test_shelve_changed_root_id(self):
 
112
        tree = self.make_branch_and_tree('.')
 
113
        self.build_tree(['foo'])
 
114
        tree.set_root_id('first-root-id')
 
115
        tree.add(['foo'], ['foo-id'])
 
116
        tree.commit('foo')
 
117
        tree.set_root_id('second-root-id')
 
118
        tree.lock_tree_write()
 
119
        self.addCleanup(tree.unlock)
 
120
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
 
121
        self.addCleanup(creator.finalize)
 
122
        self.expectFailure('shelf doesn\'t support shelving root changes yet',
 
123
            self.assertEqual, [
 
124
                ('delete file', 'first-root-id', 'directory', ''),
 
125
                ('add file', 'second-root-id', 'directory', ''),
 
126
                ('rename', 'foo-id', u'foo', u'foo'),
 
127
                ], list(creator.iter_shelvable()))
 
128
 
 
129
        self.assertEqual([('delete file', 'first-root-id', 'directory', ''),
 
130
                          ('add file', 'second-root-id', 'directory', ''),
 
131
                          ('rename', 'foo-id', u'foo', u'foo'),
 
132
                         ], list(creator.iter_shelvable()))
 
133
 
111
134
    def assertShelvedFileEqual(self, expected_content, creator, file_id):
112
135
        s_trans_id = creator.shelf_transform.trans_id_file_id(file_id)
113
136
        shelf_file = creator.shelf_transform._limbo_name(s_trans_id)