/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_commit.py

  • Committer: Martin Pool
  • Date: 2005-09-16 08:34:00 UTC
  • Revision ID: mbp@sourcefrog.net-20050916083359-a4cf382069a23604
- add test for moving files between directories

Show diffs side-by-side

added added

removed removed

Lines of Context:
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'])
144
145
 
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'])
 
150
 
 
151
 
 
152
    def test_reused_rev_id(self):
 
153
        pass
 
154
 
 
155
 
 
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)
 
162
 
 
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'])
 
167
 
 
168
        b.move(['b'], 'a')
 
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'])
 
174
 
 
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'])
 
180
        
 
181
        
149
182
        
150
183
 
151
184
    def test_removed_commit(self):