~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevisionnamespaces.py

  • Committer: Lalo Martins
  • Date: 2005-09-07 15:28:14 UTC
  • mto: (1185.1.22)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: lalo@exoweb.net-20050907152813-da20c1411bc3be7f
moving the 'revision spec' stuff out of the Branch class and into a new
module (obeying a XXX comment).

This is the last XXX in branch.py, except for the ones I added :-)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        """Functional tests for hashcache"""
23
23
        from bzrlib.errors import NoSuchRevision
24
24
        from bzrlib.branch import Branch
 
25
        from bzrlib.revisionspec import get_revision_info
25
26
 
26
27
        b = Branch('.', init=True)
27
28
 
29
30
        b.commit('Commit two', rev_id='a@r-0-2')
30
31
        b.commit('Commit three', rev_id='a@r-0-3')
31
32
 
32
 
        self.assertEquals(b.get_revision_info(None), (0, None))
33
 
        self.assertEquals(b.get_revision_info(1), (1, 'a@r-0-1'))
34
 
        self.assertEquals(b.get_revision_info('revno:1'), (1, 'a@r-0-1'))
35
 
        self.assertEquals(b.get_revision_info('revid:a@r-0-1'), (1, 'a@r-0-1'))
36
 
        self.assertRaises(NoSuchRevision, b.get_revision_info, 'revid:a@r-0-0')
37
 
        self.assertRaises(TypeError, b.get_revision_info, object)
38
 
 
39
 
        self.assertEquals(b.get_revision_info('date:-tomorrow'), (3, 'a@r-0-3'))
40
 
        self.assertEquals(b.get_revision_info('date:+today'), (1, 'a@r-0-1'))
41
 
 
42
 
        self.assertEquals(b.get_revision_info('last:1'), (3, 'a@r-0-3'))
43
 
        self.assertEquals(b.get_revision_info('-1'), (3, 'a@r-0-3'))
 
33
        self.assertEquals(get_revision_info(b, None), (0, None))
 
34
        self.assertEquals(get_revision_info(b, 1), (1, 'a@r-0-1'))
 
35
        self.assertEquals(get_revision_info(b, 'revno:1'), (1, 'a@r-0-1'))
 
36
        self.assertEquals(get_revision_info(b, 'revid:a@r-0-1'), (1, 'a@r-0-1'))
 
37
        self.assertRaises(NoSuchRevision, get_revision_info, b, 'revid:a@r-0-0')
 
38
        self.assertRaises(TypeError, get_revision_info, b, object)
 
39
 
 
40
        self.assertEquals(get_revision_info(b, 'date:-tomorrow'), (3, 'a@r-0-3'))
 
41
        self.assertEquals(get_revision_info(b, 'date:+today'), (1, 'a@r-0-1'))
 
42
 
 
43
        self.assertEquals(get_revision_info(b, 'last:1'), (3, 'a@r-0-3'))
 
44
        self.assertEquals(get_revision_info(b, '-1'), (3, 'a@r-0-3'))
44
45
 
45
46
        os.mkdir('newbranch')
46
47
        b2 = Branch('newbranch', init=True)
47
 
        self.assertEquals(b2.lookup_revision('revid:a@r-0-1'), 'a@r-0-1')
 
48
        self.assertEquals(b2.lookup_revision('revid:a@r-0-1'), None)