~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

  • Committer: Jelmer Vernooij
  • Date: 2012-02-20 12:19:29 UTC
  • mfrom: (6437.23.11 2.5)
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: jelmer@samba.org-20120220121929-7ni2psvjoatm1yp4
Merge bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for Branch.revision_id_to_revno()"""
18
18
 
19
19
from bzrlib import errors
 
20
from bzrlib.tests import TestNotApplicable
20
21
 
21
22
from bzrlib.tests.per_branch import TestCaseWithBranch
22
23
 
41
42
 
42
43
    def test_mainline_ghost(self):
43
44
        tree = self.make_branch_and_tree('tree1')
 
45
        if not tree.branch.repository._format.supports_ghosts:
 
46
            raise TestNotApplicable("repository format does not support ghosts")
44
47
        tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
45
48
        tree.add('')
46
49
        tree.commit('msg1', rev_id='rev1')
53
56
            tree.branch.revision_id_to_revno, "unknown")
54
57
        self.assertEquals(1, tree.branch.revision_id_to_revno("rev1"))
55
58
        self.assertEquals(2, tree.branch.revision_id_to_revno("rev2"))
 
59
 
 
60
    def test_empty(self):
 
61
        branch = self.make_branch('.')
 
62
        self.assertRaises(errors.NoSuchRevision,
 
63
            branch.revision_id_to_revno, "unknown")
 
64
        self.assertEquals(0, branch.revision_id_to_revno('null:'))