/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/tests/test_commit.py

  • Committer: Robert Collins
  • Date: 2008-02-13 03:30:01 UTC
  • mfrom: (3221 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3224.
  • Revision ID: robertc@robertcollins.net-20080213033001-rw70ul0zb02ph856
Merge to fix conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import bzrlib
21
21
from bzrlib import (
 
22
    bzrdir,
22
23
    errors,
23
24
    lockdir,
24
25
    osutils,
95
96
        eq(rev.message, 'add hello')
96
97
 
97
98
        tree1 = b.repository.revision_tree(rh[0])
 
99
        tree1.lock_read()
98
100
        text = tree1.get_file_text(file_id)
99
 
        eq(text, 'hello world')
 
101
        tree1.unlock()
 
102
        self.assertEqual('hello world', text)
100
103
 
101
104
        tree2 = b.repository.revision_tree(rh[1])
102
 
        eq(tree2.get_file_text(file_id), 'version 2')
 
105
        tree2.lock_read()
 
106
        text = tree2.get_file_text(file_id)
 
107
        tree2.unlock()
 
108
        self.assertEqual('version 2', text)
103
109
 
104
110
    def test_delete_commit(self):
105
111
        """Test a commit with a deleted file"""
168
174
        eq(b.revno(), 3)
169
175
 
170
176
        tree2 = b.repository.revision_tree('test@rev-2')
 
177
        tree2.lock_read()
 
178
        self.addCleanup(tree2.unlock)
171
179
        self.assertTrue(tree2.has_filename('hello'))
172
180
        self.assertEquals(tree2.get_file_text('hello-id'), 'hello')
173
181
        self.assertEquals(tree2.get_file_text('buongia-id'), 'new text')
174
182
        
175
183
        tree3 = b.repository.revision_tree('test@rev-3')
 
184
        tree3.lock_read()
 
185
        self.addCleanup(tree3.unlock)
176
186
        self.assertFalse(tree3.has_filename('hello'))
177
187
        self.assertEquals(tree3.get_file_text('buongia-id'), 'new text')
178
188
 
189
199
 
190
200
        eq = self.assertEquals
191
201
        tree1 = b.repository.revision_tree('test@rev-1')
 
202
        tree1.lock_read()
 
203
        self.addCleanup(tree1.unlock)
192
204
        eq(tree1.id2path('hello-id'), 'hello')
193
205
        eq(tree1.get_file_text('hello-id'), 'contents of hello\n')
194
206
        self.assertFalse(tree1.has_filename('fruity'))
197
209
        eq(ie.revision, 'test@rev-1')
198
210
 
199
211
        tree2 = b.repository.revision_tree('test@rev-2')
 
212
        tree2.lock_read()
 
213
        self.addCleanup(tree2.unlock)
200
214
        eq(tree2.id2path('hello-id'), 'fruity')
201
215
        eq(tree2.get_file_text('hello-id'), 'contents of hello\n')
202
216
        self.check_inventory_shape(tree2.inventory, ['fruity'])
727
741
        rev = tree.branch.repository.get_revision(rev_id)
728
742
        self.assertEqual('John Doe <jdoe@example.com>',
729
743
                         rev.properties['author'])
 
744
 
 
745
    def test_commit_with_checkout_and_branch_sharing_repo(self):
 
746
        repo = self.make_repository('repo', shared=True)
 
747
        # make_branch_and_tree ignores shared repos
 
748
        branch = bzrdir.BzrDir.create_branch_convenience('repo/branch')
 
749
        tree2 = branch.create_checkout('repo/tree2')
 
750
        tree2.commit('message', rev_id='rev1')
 
751
        self.assertTrue(tree2.branch.repository.has_revision('rev1'))