169
169
def test_commit_move(self):
170
170
"""Test commit of revisions with moved files and directories"""
171
eq = self.assertEquals
171
172
b = Branch('.', init=True)
172
174
self.build_tree(['hello', 'a/', 'b/'])
173
175
b.add(['hello', 'a', 'b'], ['hello-id', 'a-id', 'b-id'])
174
b.commit('initial', rev_id='test@rev-1', allow_pointless=False)
176
b.commit('initial', rev_id=r1, allow_pointless=False)
176
178
b.move(['hello'], 'a')
177
b.commit('two', rev_id='test@rev-2', allow_pointless=False)
180
b.commit('two', rev_id=r2, allow_pointless=False)
178
181
self.check_inventory_shape(b.inventory,
179
182
['a', 'a/hello', 'b'])
181
184
b.move(['b'], 'a')
182
b.commit('three', rev_id='test@rev-3', allow_pointless=False)
186
b.commit('three', rev_id=r3, allow_pointless=False)
183
187
self.check_inventory_shape(b.inventory,
184
188
['a', 'a/hello', 'a/b'])
185
self.check_inventory_shape(b.get_revision_inventory('test@rev-3'),
189
self.check_inventory_shape(b.get_revision_inventory(r3),
186
190
['a', 'a/hello', 'a/b'])
188
192
b.move([os.sep.join(['a', 'hello'])],
189
193
os.sep.join(['a', 'b']))
190
b.commit('four', rev_id='test@rev-4', allow_pointless=False)
195
b.commit('four', rev_id=r4, allow_pointless=False)
191
196
self.check_inventory_shape(b.inventory,
192
197
['a', 'a/b/hello', 'a/b'])
199
inv = b.get_revision_inventory(r4)
200
eq(inv['hello-id'].name_version, r4)
201
eq(inv['a-id'].name_version, r1)
202
eq(inv['b-id'].name_version, r3)
197
205
def test_removed_commit(self):
198
206
"""Test a commit with a removed file"""
199
207
b = Branch('.', init=True)