~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
 
18
 
from bzrlib.tests import TestCaseWithTransport
19
 
 
20
 
 
21
 
class TestCatRevision(TestCaseWithTransport):
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
from bzrlib.tests import blackbox
 
18
 
 
19
 
 
20
class TestCatRevision(blackbox.ExternalBase):
22
21
 
23
22
    def test_cat_unicode_revision(self):
24
23
        tree = self.make_branch_and_tree('.')
37
36
        wt.commit('Commit two', rev_id='a@r-0-2')
38
37
        wt.commit('Commit three', rev_id='a@r-0-3')
39
38
 
40
 
        r.lock_read()
41
 
        try:
42
 
            revs = {}
43
 
            for i in (1, 2, 3):
44
 
                revid = "a@r-0-%d" % i
45
 
                stream = r.revisions.get_record_stream([(revid,)], 'unordered', 
46
 
                                                       False) 
47
 
                revs[i] = stream.next().get_bytes_as('fulltext')
48
 
        finally:
49
 
            r.unlock()
50
 
 
51
 
        for i in [1, 2, 3]:
52
 
            self.assertEqual(revs[i],
53
 
                self.run_bzr('cat-revision -r revid:a@r-0-%d' % i)[0])
54
 
            self.assertEqual(revs[i],
55
 
                self.run_bzr('cat-revision a@r-0-%d' % i)[0])
56
 
            self.assertEqual(revs[i],
57
 
                self.run_bzr('cat-revision -r %d' % i)[0])
 
39
        revs = {
 
40
            1:r.get_revision_xml('a@r-0-1'),
 
41
            2:r.get_revision_xml('a@r-0-2'),
 
42
            3:r.get_revision_xml('a@r-0-3'),
 
43
        }
 
44
 
 
45
        self.check_output(revs[1], 'cat-revision a@r-0-1')
 
46
        self.check_output(revs[2], 'cat-revision a@r-0-2')
 
47
        self.check_output(revs[3], 'cat-revision a@r-0-3')
 
48
 
 
49
        self.check_output(revs[1], 'cat-revision -r 1')
 
50
        self.check_output(revs[2], 'cat-revision -r 2')
 
51
        self.check_output(revs[3], 'cat-revision -r 3')
 
52
 
 
53
        self.check_output(revs[1], 'cat-revision -r revid:a@r-0-1')
 
54
        self.check_output(revs[2], 'cat-revision -r revid:a@r-0-2')
 
55
        self.check_output(revs[3], 'cat-revision -r revid:a@r-0-3')
58
56
 
59
57
    def test_cat_no_such_revid(self):
60
58
        tree = self.make_branch_and_tree('.')
61
59
        err = self.run_bzr('cat-revision abcd', retcode=3)[1]
62
60
        self.assertContainsRe(err, 'The repository .* contains no revision abcd.')
63
61
 
64
 
    def test_cat_revision_directory(self):
65
 
        """Test --directory option"""
66
 
        tree = self.make_branch_and_tree('a')
67
 
        tree.commit('This revision', rev_id='abcd')
68
 
        output, errors = self.run_bzr(['cat-revision', '-d', 'a', u'abcd'])
69
 
        self.assertContainsRe(output, 'This revision')
70
 
        self.assertEqual('', errors)
71
62
 
72
 
    def test_cat_tree_less_branch(self):
73
 
        tree = self.make_branch_and_tree('.')
74
 
        tree.commit('This revision', rev_id='abcd')
75
 
        tree.bzrdir.destroy_workingtree()
76
 
        output, errors = self.run_bzr(['cat-revision', '-d', 'a', u'abcd'])
77
 
        self.assertContainsRe(output, 'This revision')
78
 
        self.assertEqual('', errors)