/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 07:38:10 UTC
  • Revision ID: mbp@sourcefrog.net-20050916073810-1f358be198c9ed91
- fix bug in committing files that are renamed but not modified

- add test for this

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
        tree3 = b.revision_tree('test@rev-3')
126
126
        self.assertFalse(tree3.has_filename('hello'))
127
127
        self.assertEquals(tree3.get_file_text('buongia-id'), 'new text')
 
128
 
 
129
 
 
130
    def test_commit_rename(self):
 
131
        """Test commit of a revision where a file is renamed."""
 
132
        b = Branch('.', init=True)
 
133
        self.build_tree(['hello'])
 
134
        b.add(['hello'], ['hello-id'])
 
135
        b.commit(message='one', rev_id='test@rev-1', allow_pointless=False)
 
136
 
 
137
        b.rename_one('hello', 'fruity')
 
138
        b.commit(message='renamed', rev_id='test@rev-2', allow_pointless=False)
 
139
 
 
140
        tree1 = b.revision_tree('test@rev-1')
 
141
        self.assertEquals(tree1.id2path('hello-id'), 'hello')
 
142
        self.assertEquals(tree1.get_file_text('hello-id'), 'contents of hello\n')
 
143
        self.assertFalse(tree1.has_filename('fruity'))
 
144
 
 
145
        tree2 = b.revision_tree('test@rev-2')
 
146
        self.assertEquals(tree2.id2path('hello-id'), 'fruity')
 
147
        self.assertEquals(tree2.get_file_text('hello-id'), 'contents of hello\n')
 
148
        self.assertFalse(tree2.has_filename('hello'))
128
149
        
129
150
 
130
 
 
131
151
    def test_removed_commit(self):
132
152
        """Test a commit with a removed file"""
133
153
        b = Branch('.', init=True)