1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2005, 2006, 2007, 2009 Canonical Ltd
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
158
158
self.make_linear_branch()
159
159
self.assertLogRevnos(['-c1'], ['1'])
161
def test_branch_revspec(self):
162
foo = self.make_branch_and_tree('foo')
163
bar = self.make_branch_and_tree('bar')
164
self.build_tree(['foo/foo.txt', 'bar/bar.txt'])
167
foo.commit(message='foo')
168
bar.commit(message='bar')
169
self.run_bzr('log -r branch:../bar', working_dir='foo')
170
self.assertEqual([bar.branch.get_rev_id(1)],
172
for r in self.get_captured_revisions()])
175
class TestLogExcludeCommonAncestry(TestLogWithLogCatcher):
177
def test_exclude_common_ancestry_simple_revnos(self):
178
self.make_linear_branch()
179
self.assertLogRevnos(['-r1..3', '--exclude-common-ancestry'],
183
162
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
188
167
# stop calling run_bzr, there is no point) --vila 100118.
189
168
builder = branchbuilder.BranchBuilder(self.get_transport())
190
169
builder.start_series()
204
171
builder.build_snapshot('1', None, [
205
172
('add', ('', 'root-id', 'directory', ''))])
239
206
class Test_GenerateAllRevisions(TestLogWithLogCatcher):
242
super(Test_GenerateAllRevisions, self).setUp()
243
builder = self.make_branch_with_many_merges()
244
b = builder.get_branch()
246
self.addCleanup(b.unlock)
249
208
def make_branch_with_many_merges(self, path='.', format=None):
250
209
builder = branchbuilder.BranchBuilder(self.get_transport())
251
210
builder.start_series()
269
228
def test_not_an_ancestor(self):
229
builder = self.make_branch_with_many_merges()
230
b = builder.get_branch()
232
self.addCleanup(b.unlock)
270
233
self.assertRaises(errors.BzrCommandError,
271
234
log._generate_all_revisions,
272
self.branch, '1.1.1', '2.1.3', 'reverse',
235
b, '1.1.1', '2.1.3', 'reverse',
273
236
delayed_graph_generation=True)
275
238
def test_wrong_order(self):
239
builder = self.make_branch_with_many_merges()
240
b = builder.get_branch()
242
self.addCleanup(b.unlock)
276
243
self.assertRaises(errors.BzrCommandError,
277
244
log._generate_all_revisions,
278
self.branch, '5', '2.1.3', 'reverse',
245
b, '5', '2.1.3', 'reverse',
279
246
delayed_graph_generation=True)
281
def test_no_start_rev_id_with_end_rev_id_being_a_merge(self):
282
revs = log._generate_all_revisions(
283
self.branch, None, '2.1.3',
284
'reverse', delayed_graph_generation=True)
287
249
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
382
344
def test_log_bad_message_re(self):
383
345
"""Bad --message argument gives a sensible message
385
347
See https://bugs.launchpad.net/bzr/+bug/251352
387
349
self.make_minimal_branch()
388
350
out, err = self.run_bzr(['log', '-m', '*'], retcode=3)
389
self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat")
390
self.assertNotContainsRe(err, "Unprintable exception")
391
self.assertEqual(out, '')
351
self.assertEqual("bzr: ERROR: Invalid regular expression"
352
" in log message filter"
354
": nothing to repeat\n", err)
355
self.assertEqual('', out)
393
357
def test_log_unsupported_timezone(self):
394
358
self.make_linear_branch()
396
360
'options are "utc", "original", "local".'],
397
361
['log', '--timezone', 'foo'])
399
def test_log_exclude_ancestry_no_range(self):
400
self.make_linear_branch()
401
self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
402
' requires -r with two revisions'],
403
['log', '--exclude-common-ancestry'])
405
def test_log_exclude_ancestry_single_revision(self):
406
self.make_merged_branch()
407
self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
408
' requires two different revisions'],
409
['log', '--exclude-common-ancestry',
412
364
class TestLogTags(TestLog):