~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_revision_info.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-11 04:48:55 UTC
  • mfrom: (1551.13.18 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20070411044855-b83c4dc6fd093648
Fix bzr cat-revision REVISION_ID

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import os
18
18
 
19
19
from bzrlib.errors import BzrCommandError, NoSuchRevision
20
 
from bzrlib.tests import TestCaseWithTransport
 
20
from bzrlib.tests.blackbox import ExternalBase
21
21
from bzrlib.workingtree import WorkingTree
22
22
 
23
23
 
24
 
class TestRevisionInfo(TestCaseWithTransport):
 
24
class TestRevisionInfo(ExternalBase):
25
25
    
26
26
    def check_error(self, output, *args):
27
27
        """Verify that the expected error matches what bzr says.
31
31
        """
32
32
        self.assertContainsRe(self.run_bzr_captured(args, retcode=3)[1], output)
33
33
 
34
 
    def check_output(self, output, *args):
35
 
        """Verify that the expected output matches what bzr says.
36
 
        
37
 
        The output is supplied first, so that you can supply a variable
38
 
        number of arguments to bzr.
39
 
        """
40
 
        self.assertEquals(self.run_bzr_captured(args)[0], output)
41
 
 
42
34
    def test_revision_info(self):
43
35
        """Test that 'bzr revision-info' reports the correct thing."""
44
36
        wt = self.make_branch_and_tree('.')
80
72
        
81
73
        self.check_output('   1 a@r-0-1\n', 'revision-info', '-r', 'revid:a@r-0-1')
82
74
        self.check_output('   2 a@r-0-2\n', 'revision-info', '--revision', 'revid:a@r-0-2')
83
 
 
84
 
    def test_cat_revision(self):
85
 
        """Test bzr cat-revision.
86
 
        """
87
 
        wt = self.make_branch_and_tree('.')
88
 
        r = wt.branch.repository
89
 
 
90
 
        wt.commit('Commit one', rev_id='a@r-0-1')
91
 
        wt.commit('Commit two', rev_id='a@r-0-2')
92
 
        wt.commit('Commit three', rev_id='a@r-0-3')
93
 
 
94
 
        revs = {
95
 
            1:r.get_revision_xml('a@r-0-1'),
96
 
            2:r.get_revision_xml('a@r-0-2'),
97
 
            3:r.get_revision_xml('a@r-0-3'),
98
 
        }
99
 
 
100
 
        self.check_output(revs[1], 'cat-revision', 'a@r-0-1')
101
 
        self.check_output(revs[2], 'cat-revision', 'a@r-0-2')
102
 
        self.check_output(revs[3], 'cat-revision', 'a@r-0-3')
103
 
 
104
 
        self.check_output(revs[1], 'cat-revision', '-r', '1')
105
 
        self.check_output(revs[2], 'cat-revision', '-r', '2')
106
 
        self.check_output(revs[3], 'cat-revision', '-r', '3')
107
 
 
108
 
        self.check_output(revs[1], 'cat-revision', '-r', 'revid:a@r-0-1')
109
 
        self.check_output(revs[2], 'cat-revision', '-r', 'revid:a@r-0-2')
110
 
        self.check_output(revs[3], 'cat-revision', '-r', 'revid:a@r-0-3')
111