76
77
self.log_catcher = test_log.LogCatcher(*args, **kwargs)
77
78
# Always return our own log formatter
78
79
return self.log_catcher
79
# Break cycle with closure over self on cleanup by removing method
80
self.addCleanup(setattr, MyLogFormatter, "__new__", None)
83
82
# Always return our own log formatter class hijacking the
159
158
self.make_linear_branch()
160
159
self.assertLogRevnos(['-c1'], ['1'])
162
def test_branch_revspec(self):
163
foo = self.make_branch_and_tree('foo')
164
bar = self.make_branch_and_tree('bar')
165
self.build_tree(['foo/foo.txt', 'bar/bar.txt'])
168
foo.commit(message='foo')
169
bar.commit(message='bar')
170
self.run_bzr('log -r branch:../bar', working_dir='foo')
171
self.assertEqual([bar.branch.get_rev_id(1)],
173
for r in self.get_captured_revisions()])
176
class TestLogExcludeCommonAncestry(TestLogWithLogCatcher):
178
def test_exclude_common_ancestry_simple_revnos(self):
179
self.make_linear_branch()
180
self.assertLogRevnos(['-r1..3', '--exclude-common-ancestry'],
184
162
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
189
167
# stop calling run_bzr, there is no point) --vila 100118.
190
168
builder = branchbuilder.BranchBuilder(self.get_transport())
191
169
builder.start_series()
205
171
builder.build_snapshot('1', None, [
206
172
('add', ('', 'root-id', 'directory', ''))])
383
349
def test_log_bad_message_re(self):
384
350
"""Bad --message argument gives a sensible message
386
352
See https://bugs.launchpad.net/bzr/+bug/251352
388
354
self.make_minimal_branch()
389
355
out, err = self.run_bzr(['log', '-m', '*'], retcode=3)
390
self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat")
391
self.assertNotContainsRe(err, "Unprintable exception")
392
self.assertEqual(out, '')
356
self.assertEqual("bzr: ERROR: Invalid regular expression"
357
" in log message filter"
359
": nothing to repeat\n", err)
360
self.assertEqual('', out)
394
362
def test_log_unsupported_timezone(self):
395
363
self.make_linear_branch()
443
411
self.assertContainsRe(log, r'tags: tag1')
446
class TestLogSignatures(TestLog):
448
def test_log_with_signatures(self):
449
self.requireFeature(features.gpgme)
451
tree = self.make_linear_branch(format='dirstate-tags')
453
log = self.run_bzr("log --signatures")[0]
454
self.assertTrue('signature: no signature' in log)
456
def test_log_without_signatures(self):
457
self.requireFeature(features.gpgme)
459
tree = self.make_linear_branch(format='dirstate-tags')
461
log = self.run_bzr("log")[0]
462
self.assertFalse('signature: no signature' in log)
465
414
class TestLogVerbose(TestLog):
483
432
def test_log_short_verbose(self):
484
433
self.assertUseShortDeltaFormat(['log', '--short', '-v'])
486
def test_log_s_verbose(self):
487
self.assertUseShortDeltaFormat(['log', '-S', '-v'])
489
435
def test_log_short_verbose_verbose(self):
490
436
self.assertUseLongDeltaFormat(['log', '--short', '-vv'])
947
893
self.prepare_tree()
949
895
self.assertLogRevnos(['dir2', 'file5'], ['5', '3'])
952
class MainlineGhostTests(TestLogWithLogCatcher):
955
super(MainlineGhostTests, self).setUp()
956
tree = self.make_branch_and_tree('')
957
tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
959
tree.commit('msg1', rev_id='rev1')
960
tree.commit('msg2', rev_id='rev2')
962
def test_log_range(self):
963
self.assertLogRevnos(["-r1..2"], ["2", "1"])
965
def test_log_norange(self):
966
self.assertLogRevnos([], ["2", "1"])
968
def test_log_range_open_begin(self):
969
raise tests.KnownFailure("log with ghosts fails. bug #726466")
970
(stdout, stderr) = self.run_bzr(['log', '-r..2'], retcode=3)
971
self.assertEqual(["2", "1"],
972
[r.revno for r in self.get_captured_revisions()])
973
self.assertEquals("bzr: ERROR: Further revision history missing.", stderr)
975
def test_log_range_open_end(self):
976
self.assertLogRevnos(["-r1.."], ["2", "1"])