20
20
class TestRevisionNamespaces(InTempDir):
21
21
"""Functional tests for hashcache"""
23
from bzrlib.errors import BzrError
23
from bzrlib.errors import NoSuchRevision
24
24
from bzrlib.branch import Branch
31
31
b.commit('Commit two', rev_id='a@r-0-2')
32
32
b.commit('Commit three', rev_id='a@r-0-3')
34
self.assertEquals(b.get_revision_info(None), (0, None))
34
35
self.assertEquals(b.get_revision_info(1), (1, 'a@r-0-1'))
35
36
self.assertEquals(b.get_revision_info('revno:1'), (1, 'a@r-0-1'))
36
37
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')
38
self.assertRaises(NoSuchRevision, b.get_revision_info, 'revid:a@r-0-0')
39
self.assertRaises(TypeError, b.get_revision_info, object)
39
41
self.assertEquals(b.get_revision_info('date:-tomorrow'), (3, 'a@r-0-3'))
40
42
self.assertEquals(b.get_revision_info('date:+today'), (1, 'a@r-0-1'))
42
44
self.assertEquals(b.get_revision_info('last:1'), (3, 'a@r-0-3'))
45
self.assertEquals(b.get_revision_info('-1'), (3, 'a@r-0-3'))
48
b2 = Branch('newbranch', init=True)
49
self.assertEquals(b2.lookup_revision('revid:a@r-0-1'), 'a@r-0-1')
45
52
TestRevisionNamespaces