~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_revision_id_to_revno.py

merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        self.assertRaises(errors.NoSuchRevision,
40
40
                          the_branch.revision_id_to_revno, 'rev-1.1.1')
41
41
 
 
42
    def test_mainline_ghost(self):
 
43
        tree = self.make_branch_and_tree('tree1')
 
44
        tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
 
45
        tree.add('')
 
46
        tree.commit('msg1', rev_id='rev1')
 
47
        tree.commit('msg2', rev_id='rev2')
 
48
        # Some older branch formats store the full known revision history
 
49
        # and thus can't distinguish between not being able to find a revno because of
 
50
        # a ghost and the revision not being on the mainline. As such,
 
51
        # allow both NoSuchRevision and GhostRevisionsHaveNoRevno here.
 
52
        self.assertRaises((errors.NoSuchRevision, errors.GhostRevisionsHaveNoRevno),
 
53
            tree.branch.revision_id_to_revno, "unknown")
 
54
        self.assertEquals(1, tree.branch.revision_id_to_revno("rev1"))
 
55
        self.assertEquals(2, tree.branch.revision_id_to_revno("rev2"))