~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-08 00:40:15 UTC
  • mto: (1185.1.22)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: lalo@exoweb.net-20050908004014-bb63b3378ac8ff58
turned get_revision_info into a RevisionSpec class

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
        from bzrlib.revisionspec import RevisionSpec
26
26
 
27
27
        b = Branch('.', init=True)
28
28
 
30
30
        b.commit('Commit two', rev_id='a@r-0-2')
31
31
        b.commit('Commit three', rev_id='a@r-0-3')
32
32
 
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'))
45
 
 
46
 
        os.mkdir('newbranch')
47
 
        b2 = Branch('newbranch', init=True)
48
 
        self.assertEquals(b2.lookup_revision('revid:a@r-0-1'), None)
 
33
        self.assertEquals(RevisionSpec(b, None), (0, None))
 
34
        self.assertEquals(RevisionSpec(b, 1), (1, 'a@r-0-1'))
 
35
        self.assertEquals(RevisionSpec(b, 'revno:1'), (1, 'a@r-0-1'))
 
36
        self.assertEquals(RevisionSpec(b, 'revid:a@r-0-1'), (1, 'a@r-0-1'))
 
37
        self.assertRaises(NoSuchRevision, RevisionSpec, b, 'revid:a@r-0-0')
 
38
        self.assertRaises(TypeError, RevisionSpec, b, object)
 
39
 
 
40
        self.assertEquals(RevisionSpec(b, 'date:-tomorrow'), (3, 'a@r-0-3'))
 
41
        self.assertEquals(RevisionSpec(b, 'date:+today'), (1, 'a@r-0-1'))
 
42
 
 
43
        self.assertEquals(RevisionSpec(b, 'last:1'), (3, 'a@r-0-3'))
 
44
        self.assertEquals(RevisionSpec(b, '-1'), (3, 'a@r-0-3'))