51
51
self.assertTrue('message:\n message3\n' in self.full_log)
53
53
log = self.run_bzr("log -r 1..")[0]
54
self.assertEquals(log, self.full_log)
54
self.assertEqualDiff(log, self.full_log)
56
56
def test_log_null_begin_revspec(self):
58
58
log = self.run_bzr("log -r ..3")[0]
59
self.assertEquals(self.full_log, log)
59
self.assertEqualDiff(self.full_log, log)
61
61
def test_log_null_both_revspecs(self):
63
63
log = self.run_bzr("log -r ..")[0]
64
64
self.assertEquals(self.full_log, log)
65
self.assertEqualDiff(self.full_log, log)
66
67
def test_log_negative_begin_revspec_full_log(self):
68
69
log = self.run_bzr("log -r -3..")[0]
69
self.assertEquals(self.full_log, log)
70
self.assertEqualDiff(self.full_log, log)
71
72
def test_log_negative_both_revspec_full_log(self):
73
74
log = self.run_bzr("log -r -3..-1")[0]
74
self.assertEquals(self.full_log, log)
75
self.assertEqualDiff(self.full_log, log)
76
77
def test_log_negative_both_revspec_partial(self):
155
164
self.assertTrue('revno: 2\n' in log)
156
165
self.assertTrue('revno: 3\n' in log)
159
167
class TestLogMerges(ExternalBase):
161
def test_merges_are_indented_by_level(self):
162
170
self.build_tree(['parent/'])
163
self.run_bzr('init', 'parent')
164
self.run_bzr('commit', '-m', 'first post', '--unchanged', 'parent')
165
self.run_bzr('branch', 'parent', 'child')
166
self.run_bzr('commit', '-m', 'branch 1', '--unchanged', 'child')
167
self.run_bzr('branch', 'child', 'smallerchild')
168
self.run_bzr('commit', '-m', 'branch 2', '--unchanged', 'smallerchild')
171
self.run_bzr('init parent')
172
self.run_bzr(['commit', '-m', 'first post', '--unchanged', 'parent'])
173
self.run_bzr('branch parent child')
174
self.run_bzr(['commit', '-m', 'branch 1', '--unchanged', 'child'])
175
self.run_bzr('branch child smallerchild')
176
self.run_bzr(['commit', '-m', 'branch 2', '--unchanged',
169
178
os.chdir('child')
170
self.run_bzr('merge', '../smallerchild')
171
self.run_bzr('commit', '-m', 'merge branch 2')
179
self.run_bzr('merge ../smallerchild')
180
self.run_bzr(['commit', '-m', 'merge branch 2'])
172
181
os.chdir('../parent')
173
self.run_bzr('merge', '../child')
174
self.run_bzr('commit', '-m', 'merge branch 1')
182
self.run_bzr('merge ../child')
183
self.run_bzr(['commit', '-m', 'merge branch 1'])
185
def test_merges_are_indented_by_level(self):
175
187
out,err = self.run_bzr('log')
176
188
# the log will look something like:
177
189
# self.assertEqual("""\
225
234
self.assertTrue(' branch 2' in out)
226
235
self.assertTrue(' revno: 1.1.1' in out)
227
236
self.assertTrue(' branch 1' in out)
228
self.assertTrue('revno: 1' in out)
237
self.assertTrue('revno: 1\n' in out)
229
238
self.assertTrue(' first post' in out)
230
239
self.assertEqual('', err)
241
def test_merges_single_merge_rev(self):
243
out,err = self.run_bzr('log -r1.1.2')
244
# the log will look something like:
245
# self.assertEqual("""\
246
# ------------------------------------------------------------
248
# committer: Robert Collins <foo@example.com>
250
# timestamp: Tue 2006-03-28 22:31:40 +1100
253
# ------------------------------------------------------------
255
# committer: Robert Collins <foo@example.com>
256
# branch nick: smallerchild
257
# timestamp: Tue 2006-03-28 22:31:40 +1100
261
# but we dont have a nice pattern matcher hooked up yet, so:
262
# we check for the indenting of the commit message and the
264
self.assertTrue('revno: 2' not in out)
265
self.assertTrue(' merge branch 1' not in out)
266
self.assertTrue(' revno: 1.1.2' in out)
267
self.assertTrue(' merge branch 2' in out)
268
self.assertTrue(' revno: 1.1.1.1' in out)
269
self.assertTrue(' branch 2' in out)
270
self.assertTrue(' revno: 1.1.1\n' not in out)
271
self.assertTrue(' branch 1' not in out)
272
self.assertTrue('revno: 1\n' not in out)
273
self.assertTrue(' first post' not in out)
274
self.assertEqual('', err)
276
def test_merges_partial_range(self):
278
out,err = self.run_bzr('log -r1.1.1..1.1.2')
279
# the log will look something like:
280
# self.assertEqual("""\
281
# ------------------------------------------------------------
283
# committer: Robert Collins <foo@example.com>
285
# timestamp: Tue 2006-03-28 22:31:40 +1100
288
# ------------------------------------------------------------
290
# committer: Robert Collins <foo@example.com>
291
# branch nick: smallerchild
292
# timestamp: Tue 2006-03-28 22:31:40 +1100
295
# ------------------------------------------------------------
297
# committer: Robert Collins <foo@example.com>
299
# timestamp: Tue 2006-03-28 22:31:40 +1100
303
# but we dont have a nice pattern matcher hooked up yet, so:
304
# we check for the indenting of the commit message and the
306
self.assertTrue('revno: 2' not in out)
307
self.assertTrue(' merge branch 1' not in out)
308
self.assertTrue(' revno: 1.1.2' in out)
309
self.assertTrue(' merge branch 2' in out)
310
self.assertTrue(' revno: 1.1.1.1' in out)
311
self.assertTrue(' branch 2' in out)
312
self.assertTrue(' revno: 1.1.1' in out)
313
self.assertTrue(' branch 1' in out)
314
self.assertTrue('revno: 1\n' not in out)
315
self.assertTrue(' first post' not in out)
316
self.assertEqual('', err)
233
319
class TestLogEncodings(TestCaseInTempDir):
352
438
tree.commit('add file2')
353
439
tree.add('file3')
354
440
tree.commit('add file3')
355
self.run_bzr('branch', 'parent', 'child')
441
self.run_bzr('branch parent child')
356
442
print >> file('child/file2', 'wb'), 'hello'
357
self.run_bzr('commit', '-m', 'branch 1', 'child')
443
self.run_bzr(['commit', '-m', 'branch 1', 'child'])
358
444
os.chdir('parent')
359
self.run_bzr('merge', '../child')
360
self.run_bzr('commit', '-m', 'merge child branch')
362
log = self.run_bzr('log', 'file1')[0]
445
self.run_bzr('merge ../child')
446
self.run_bzr(['commit', '-m', 'merge child branch'])
447
log = self.run_bzr('log file1')[0]
363
448
self.assertContainsRe(log, 'revno: 1\n')
364
449
self.assertNotContainsRe(log, 'revno: 2\n')
365
450
self.assertNotContainsRe(log, 'revno: 3\n')
366
451
self.assertNotContainsRe(log, 'revno: 3.1.1\n')
367
452
self.assertNotContainsRe(log, 'revno: 4\n')
368
log = self.run_bzr('log', 'file2')[0]
453
log = self.run_bzr('log file2')[0]
369
454
self.assertNotContainsRe(log, 'revno: 1\n')
370
455
self.assertContainsRe(log, 'revno: 2\n')
371
456
self.assertNotContainsRe(log, 'revno: 3\n')
372
457
self.assertContainsRe(log, 'revno: 3.1.1\n')
373
458
self.assertContainsRe(log, 'revno: 4\n')
374
log = self.run_bzr('log', 'file3')[0]
459
log = self.run_bzr('log file3')[0]
375
460
self.assertNotContainsRe(log, 'revno: 1\n')
376
461
self.assertNotContainsRe(log, 'revno: 2\n')
377
462
self.assertContainsRe(log, 'revno: 3\n')
378
463
self.assertNotContainsRe(log, 'revno: 3.1.1\n')
379
464
self.assertNotContainsRe(log, 'revno: 4\n')
465
log = self.run_bzr('log -r3.1.1 file2')[0]
466
self.assertNotContainsRe(log, 'revno: 1\n')
467
self.assertNotContainsRe(log, 'revno: 2\n')
468
self.assertNotContainsRe(log, 'revno: 3\n')
469
self.assertContainsRe(log, 'revno: 3.1.1\n')
470
self.assertNotContainsRe(log, 'revno: 4\n')
471
log = self.run_bzr('log -r4 file2')[0]
472
self.assertNotContainsRe(log, 'revno: 1\n')
473
self.assertNotContainsRe(log, 'revno: 2\n')
474
self.assertNotContainsRe(log, 'revno: 3\n')
475
self.assertContainsRe(log, 'revno: 3.1.1\n')
476
self.assertContainsRe(log, 'revno: 4\n')
477
log = self.run_bzr('log -r3.. file2')[0]
478
self.assertNotContainsRe(log, 'revno: 1\n')
479
self.assertNotContainsRe(log, 'revno: 2\n')
480
self.assertNotContainsRe(log, 'revno: 3\n')
481
self.assertContainsRe(log, 'revno: 3.1.1\n')
482
self.assertContainsRe(log, 'revno: 4\n')
483
log = self.run_bzr('log -r..3 file2')[0]
484
self.assertNotContainsRe(log, 'revno: 1\n')
485
self.assertContainsRe(log, 'revno: 2\n')
486
self.assertNotContainsRe(log, 'revno: 3\n')
487
self.assertNotContainsRe(log, 'revno: 3.1.1\n')
488
self.assertNotContainsRe(log, 'revno: 4\n')