~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: Jelmer Vernooij
  • Date: 2011-09-25 23:58:12 UTC
  • mto: This revision was merged to the branch mainline in revision 6216.
  • Revision ID: jelmer@samba.org-20110925235812-c35izhdesn8rg0l5
More fixes.

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()
366
365
            wt.commit(message='rev %d' % (i+1),
367
366
                     rev_id=rev_id)
368
367
        eq = self.assertEquals
369
 
        eq(b.revision_history(), rev_ids)
 
368
        eq(list(b.iter_revision_history()), rev_ids)
370
369
        for i in range(4):
371
370
            self.assertThat(rev_ids[:i+1],
372
371
                MatchesAncestry(b.repository, rev_ids[i]))
465
464
                              rev_id='B',
466
465
                              working_tree=wt)
467
466
            branch = Branch.open(self.get_url('.'))
468
 
            self.assertEqual(branch.revision_history(), ['A'])
 
467
            self.assertEqual(branch.last_revision(), 'A')
469
468
            self.assertFalse(branch.repository.has_revision('B'))
470
469
        finally:
471
470
            bzrlib.gpg.GPGStrategy = oldstrategy