~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: Patch Queue Manager
  • Date: 2011-10-06 10:15:06 UTC
  • mfrom: (6195.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20111006101506-mychax14dy7yjee2
(vila) Tag bzr-2.5b2 missed during freeze (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        b = wt.branch
91
91
        file('hello', 'w').write('hello world')
92
92
        wt.add('hello')
93
 
        wt.commit(message='add hello')
 
93
        rev1 = wt.commit(message='add hello')
94
94
        file_id = wt.path2id('hello')
95
95
 
96
96
        file('hello', 'w').write('version 2')
97
 
        wt.commit(message='commit 2')
 
97
        rev2 = wt.commit(message='commit 2')
98
98
 
99
99
        eq = self.assertEquals
100
100
        eq(b.revno(), 2)
101
 
        rh = b.revision_history()
102
 
        rev = b.repository.get_revision(rh[0])
 
101
        rev = b.repository.get_revision(rev1)
103
102
        eq(rev.message, 'add hello')
104
103
 
105
 
        tree1 = b.repository.revision_tree(rh[0])
 
104
        tree1 = b.repository.revision_tree(rev1)
106
105
        tree1.lock_read()
107
106
        text = tree1.get_file_text(file_id)
108
107
        tree1.unlock()
109
108
        self.assertEqual('hello world', text)
110
109
 
111
 
        tree2 = b.repository.revision_tree(rh[1])
 
110
        tree2 = b.repository.revision_tree(rev2)
112
111
        tree2.lock_read()
113
112
        text = tree2.get_file_text(file_id)
114
113
        tree2.unlock()
161
160
        wt.commit(message='add hello')
162
161
 
163
162
        os.remove('hello')
164
 
        wt.commit('removed hello', rev_id='rev2')
 
163
        reporter = CapturingReporter()
 
164
        wt.commit('removed hello', rev_id='rev2', reporter=reporter)
 
165
        self.assertEquals(
 
166
            [('missing', u'hello'), ('deleted', u'hello')],
 
167
            reporter.calls)
165
168
 
166
169
        tree = b.repository.revision_tree('rev2')
167
170
        self.assertFalse(tree.has_id('hello-id'))
461
464
                              rev_id='B',
462
465
                              working_tree=wt)
463
466
            branch = Branch.open(self.get_url('.'))
464
 
            self.assertEqual(branch.revision_history(), ['A'])
 
467
            self.assertEqual(branch.last_revision(), 'A')
465
468
            self.assertFalse(branch.repository.has_revision('B'))
466
469
        finally:
467
470
            bzrlib.gpg.GPGStrategy = oldstrategy