141
141
self.assertEquals(tree1.id2path('hello-id'), 'hello')
142
142
self.assertEquals(tree1.get_file_text('hello-id'), 'contents of hello\n')
143
143
self.assertFalse(tree1.has_filename('fruity'))
144
self.check_inventory_shape(tree1.inventory, ['hello'])
145
146
tree2 = b.revision_tree('test@rev-2')
146
147
self.assertEquals(tree2.id2path('hello-id'), 'fruity')
147
148
self.assertEquals(tree2.get_file_text('hello-id'), 'contents of hello\n')
148
self.assertFalse(tree2.has_filename('hello'))
149
self.check_inventory_shape(tree2.inventory, ['fruity'])
152
def test_reused_rev_id(self):
156
def test_commit_move(self):
157
"""Test commit of revisions with moved files and directories"""
158
b = Branch('.', init=True)
159
self.build_tree(['hello', 'a/', 'b/'])
160
b.add(['hello', 'a', 'b'], ['hello-id', 'a-id', 'b-id'])
161
b.commit('initial', rev_id='test@rev-1', allow_pointless=False)
163
b.move(['hello'], 'a')
164
b.commit('two', rev_id='test@rev-2', allow_pointless=False)
165
self.check_inventory_shape(b.inventory,
166
['a', 'a/hello', 'b'])
169
b.commit('three', rev_id='test@rev-3', allow_pointless=False)
170
self.check_inventory_shape(b.inventory,
171
['a', 'a/hello', 'a/b'])
172
self.check_inventory_shape(b.get_revision_inventory('test@rev-3'),
173
['a', 'a/hello', 'a/b'])
175
b.move([os.sep.join(['a', 'hello'])],
176
os.sep.join(['a', 'b']))
177
b.commit('four', rev_id='test@rev-4', allow_pointless=False)
178
self.check_inventory_shape(b.inventory,
179
['a', 'a/b/hello', 'a/b'])
151
184
def test_removed_commit(self):