~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_commit.py

  • Committer: Martin Pool
  • Date: 2005-09-16 09:47:48 UTC
  • Revision ID: mbp@sourcefrog.net-20050916094748-ae357c822a4eb74c
- tests that name_version is updated properly in renames/moves

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
 
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)
 
173
        r1 = 'test@rev-1'
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)
175
177
 
176
178
        b.move(['hello'], 'a')
177
 
        b.commit('two', rev_id='test@rev-2', allow_pointless=False)
 
179
        r2 = 'test@rev-2'
 
180
        b.commit('two', rev_id=r2, allow_pointless=False)
178
181
        self.check_inventory_shape(b.inventory,
179
182
                                   ['a', 'a/hello', 'b'])
180
183
 
181
184
        b.move(['b'], 'a')
182
 
        b.commit('three', rev_id='test@rev-3', allow_pointless=False)
 
185
        r3 = 'test@rev-3'
 
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'])
187
191
 
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)
 
194
        r4 = 'test@rev-4'
 
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'])
193
 
        
194
 
        
195
 
        
196
 
 
 
198
 
 
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)
 
203
 
 
204
        
197
205
    def test_removed_commit(self):
198
206
        """Test a commit with a removed file"""
199
207
        b = Branch('.', init=True)