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'],
162
183
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
167
188
# stop calling run_bzr, there is no point) --vila 100118.
168
189
builder = branchbuilder.BranchBuilder(self.get_transport())
169
190
builder.start_series()
171
204
builder.build_snapshot('1', None, [
172
205
('add', ('', 'root-id', 'directory', ''))])
206
239
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)
208
249
def make_branch_with_many_merges(self, path='.', format=None):
209
250
builder = branchbuilder.BranchBuilder(self.get_transport())
210
251
builder.start_series()
228
269
def test_not_an_ancestor(self):
229
builder = self.make_branch_with_many_merges()
230
b = builder.get_branch()
232
self.addCleanup(b.unlock)
233
270
self.assertRaises(errors.BzrCommandError,
234
271
log._generate_all_revisions,
235
b, '1.1.1', '2.1.3', 'reverse',
272
self.branch, '1.1.1', '2.1.3', 'reverse',
236
273
delayed_graph_generation=True)
238
275
def test_wrong_order(self):
239
builder = self.make_branch_with_many_merges()
240
b = builder.get_branch()
242
self.addCleanup(b.unlock)
243
276
self.assertRaises(errors.BzrCommandError,
244
277
log._generate_all_revisions,
245
b, '5', '2.1.3', 'reverse',
278
self.branch, '5', '2.1.3', 'reverse',
246
279
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)
249
287
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
344
382
def test_log_bad_message_re(self):
345
383
"""Bad --message argument gives a sensible message
347
385
See https://bugs.launchpad.net/bzr/+bug/251352
349
387
self.make_minimal_branch()
350
388
out, err = self.run_bzr(['log', '-m', '*'], retcode=3)
351
self.assertEqual("bzr: ERROR: Invalid regular expression"
352
" in log message filter"
354
": nothing to repeat\n", err)
355
self.assertEqual('', out)
389
self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat")
390
self.assertNotContainsRe(err, "Unprintable exception")
391
self.assertEqual(out, '')
357
393
def test_log_unsupported_timezone(self):
358
394
self.make_linear_branch()
360
396
'options are "utc", "original", "local".'],
361
397
['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',
364
412
class TestLogTags(TestLog):