~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_commit.py

  • Committer: Martin Pool
  • Date: 2005-09-15 06:31:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050915063111-81bb8887a39a96b7
- test that commits append to the tree's ancestry

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
        self.assertFalse(tree.has_id('hello-id'))
141
141
 
142
142
 
 
143
    def test_committed_ancestry(self):
 
144
        """Test commit appends revisions to ancestry."""
 
145
        b = Branch('.', init=True)
 
146
        rev_ids = []
 
147
        for i in range(4):
 
148
            file('hello', 'w').write((str(i) * 4) + '\n')
 
149
            if i == 0:
 
150
                b.add(['hello'], ['hello-id'])
 
151
            rev_id = 'test@rev-%d' % (i+1)
 
152
            rev_ids.append(rev_id)
 
153
            b.commit(message='rev %d' % (i+1),
 
154
                     rev_id=rev_id)
 
155
        eq = self.assertEquals
 
156
        eq(b.revision_history(), rev_ids)
 
157
        for i in range(4):
 
158
            anc = b.get_ancestry(rev_ids[i])
 
159
            eq(anc, rev_ids[:i+1])
 
160
            
 
161
        
 
162
 
 
163
 
143
164
if __name__ == '__main__':
144
165
    import unittest
145
166
    unittest.main()