~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-19 10:51:37 UTC
  • mfrom: (5891.1.3 api-docs)
  • Revision ID: pqm@pqm.ubuntu.com-20110519105137-amzagrral2ldm1lq
(spiv) Fix the formatting of more docstrings. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from itertools import izip
21
21
import os
22
 
import re
23
22
 
24
23
from bzrlib import (
25
24
    branchbuilder,
29
28
    tests,
30
29
    )
31
30
from bzrlib.tests import (
32
 
    script,
33
31
    test_log,
34
32
    )
35
33
 
158
156
        self.make_linear_branch()
159
157
        self.assertLogRevnos(['-c1'], ['1'])
160
158
 
 
159
    def test_branch_revspec(self):
 
160
        foo = self.make_branch_and_tree('foo')
 
161
        bar = self.make_branch_and_tree('bar')
 
162
        self.build_tree(['foo/foo.txt', 'bar/bar.txt'])
 
163
        foo.add('foo.txt')
 
164
        bar.add('bar.txt')
 
165
        foo.commit(message='foo')
 
166
        bar.commit(message='bar')
 
167
        self.run_bzr('log -r branch:../bar', working_dir='foo')
 
168
        self.assertEqual([bar.branch.get_rev_id(1)],
 
169
                         [r.rev.revision_id
 
170
                          for r in self.get_captured_revisions()])
 
171
 
 
172
 
 
173
class TestLogExcludeCommonAncestry(TestLogWithLogCatcher):
 
174
 
 
175
    def test_exclude_common_ancestry_simple_revnos(self):
 
176
        self.make_linear_branch()
 
177
        self.assertLogRevnos(['-r1..3', '--exclude-common-ancestry'],
 
178
                             ['3', '2'])
 
179
 
161
180
 
162
181
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
163
182
 
167
186
        # stop calling run_bzr, there is no point) --vila 100118.
168
187
        builder = branchbuilder.BranchBuilder(self.get_transport())
169
188
        builder.start_series()
 
189
        # 1
 
190
        # | \
 
191
        # 2  1.1.1
 
192
        # | / |
 
193
        # 3  1.1.2
 
194
        # |   |
 
195
        # |  1.1.3
 
196
        # | / |
 
197
        # 4  1.1.4
 
198
        # | /
 
199
        # 5
 
200
 
170
201
        # mainline
171
202
        builder.build_snapshot('1', None, [
172
203
            ('add', ('', 'root-id', 'directory', ''))])
348
379
 
349
380
    def test_log_bad_message_re(self):
350
381
        """Bad --message argument gives a sensible message
351
 
        
 
382
 
352
383
        See https://bugs.launchpad.net/bzr/+bug/251352
353
384
        """
354
385
        self.make_minimal_branch()
355
386
        out, err = self.run_bzr(['log', '-m', '*'], retcode=3)
356
 
        self.assertEqual("bzr: ERROR: Invalid regular expression"
357
 
            " in log message filter"
358
 
            ": '*'"
359
 
            ": nothing to repeat\n", err)
360
 
        self.assertEqual('', out)
 
387
        self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat")
 
388
        self.assertNotContainsRe(err, "Unprintable exception")
 
389
        self.assertEqual(out, '')
361
390
 
362
391
    def test_log_unsupported_timezone(self):
363
392
        self.make_linear_branch()
893
922
        self.prepare_tree()
894
923
        os.chdir("dir1")
895
924
        self.assertLogRevnos(['dir2', 'file5'], ['5', '3'])
 
925
 
 
926
 
 
927
class MainlineGhostTests(TestLogWithLogCatcher):
 
928
 
 
929
    def setUp(self):
 
930
        super(MainlineGhostTests, self).setUp()
 
931
        tree = self.make_branch_and_tree('')
 
932
        tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
 
933
        tree.add('')
 
934
        tree.commit('msg1', rev_id='rev1')
 
935
        tree.commit('msg2', rev_id='rev2')
 
936
 
 
937
    def test_log_range(self):
 
938
        self.assertLogRevnos(["-r1..2"], ["2", "1"])
 
939
 
 
940
    def test_log_norange(self):
 
941
        self.assertLogRevnos([], ["2", "1"])
 
942
 
 
943
    def test_log_range_open_begin(self):
 
944
        raise tests.KnownFailure("log with ghosts fails. bug #726466")
 
945
        (stdout, stderr) = self.run_bzr(['log', '-r..2'], retcode=3)
 
946
        self.assertEqual(["2", "1"],
 
947
                         [r.revno for r in self.get_captured_revisions()])
 
948
        self.assertEquals("bzr: ERROR: Further revision history missing.", stderr)
 
949
 
 
950
    def test_log_range_open_end(self):
 
951
        self.assertLogRevnos(["-r1.."], ["2", "1"])