18
18
from bzrlib.selftest import InTempDir
20
20
class TestRevisionNamespaces(InTempDir):
21
22
def test_revision_namespaces(self):
22
23
"""Functional tests for hashcache"""
23
from bzrlib.errors import BzrError
24
from bzrlib.errors import NoSuchRevision
24
25
from bzrlib.branch import Branch
31
32
b.commit('Commit two', rev_id='a@r-0-2')
32
33
b.commit('Commit three', rev_id='a@r-0-3')
35
self.assertEquals(b.get_revision_info(None), (0, None))
34
36
self.assertEquals(b.get_revision_info(1), (1, 'a@r-0-1'))
35
37
self.assertEquals(b.get_revision_info('revno:1'), (1, 'a@r-0-1'))
36
38
self.assertEquals(b.get_revision_info('revid:a@r-0-1'), (1, 'a@r-0-1'))
37
self.assertRaises(BzrError, b.get_revision_info, 'revid:a@r-0-0')
39
self.assertRaises(NoSuchRevision, b.get_revision_info, 'revid:a@r-0-0')
40
self.assertRaises(TypeError, b.get_revision_info, object)
39
42
self.assertEquals(b.get_revision_info('date:-tomorrow'), (3, 'a@r-0-3'))
40
43
self.assertEquals(b.get_revision_info('date:+today'), (1, 'a@r-0-1'))
42
45
self.assertEquals(b.get_revision_info('last:1'), (3, 'a@r-0-3'))
46
self.assertEquals(b.get_revision_info('-1'), (3, 'a@r-0-3'))
49
b2 = Branch('newbranch', init=True)
50
self.assertEquals(b2.lookup_revision('revid:a@r-0-1'), 'a@r-0-1')