51
51
self.assertTrue('message:\n message3\n' in self.full_log)
53
53
log = self.run_bzr("log -r 1..")[0]
54
self.assertEqualDiff(log, self.full_log)
54
self.assertEquals(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.assertEqualDiff(self.full_log, log)
59
self.assertEquals(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)
67
66
def test_log_negative_begin_revspec_full_log(self):
69
68
log = self.run_bzr("log -r -3..")[0]
70
self.assertEqualDiff(self.full_log, log)
69
self.assertEquals(self.full_log, log)
72
71
def test_log_negative_both_revspec_full_log(self):
74
73
log = self.run_bzr("log -r -3..-1")[0]
75
self.assertEqualDiff(self.full_log, log)
74
self.assertEquals(self.full_log, log)
77
76
def test_log_negative_both_revspec_partial(self):
164
155
self.assertTrue('revno: 2\n' in log)
165
156
self.assertTrue('revno: 3\n' in log)
167
159
class TestLogMerges(ExternalBase):
161
def test_merges_are_indented_by_level(self):
170
162
self.build_tree(['parent/'])
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',
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')
178
169
os.chdir('child')
179
self.run_bzr('merge ../smallerchild')
180
self.run_bzr(['commit', '-m', 'merge branch 2'])
170
self.run_bzr('merge', '../smallerchild')
171
self.run_bzr('commit', '-m', 'merge branch 2')
181
172
os.chdir('../parent')
182
self.run_bzr('merge ../child')
183
self.run_bzr(['commit', '-m', 'merge branch 1'])
185
def test_merges_are_indented_by_level(self):
173
self.run_bzr('merge', '../child')
174
self.run_bzr('commit', '-m', 'merge branch 1')
187
175
out,err = self.run_bzr('log')
188
176
# the log will look something like:
189
177
# self.assertEqual("""\
234
225
self.assertTrue(' branch 2' in out)
235
226
self.assertTrue(' revno: 1.1.1' in out)
236
227
self.assertTrue(' branch 1' in out)
237
self.assertTrue('revno: 1\n' in out)
228
self.assertTrue('revno: 1' in out)
238
229
self.assertTrue(' first post' in out)
239
230
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)
319
233
class TestLogEncodings(TestCaseInTempDir):
438
352
tree.commit('add file2')
439
353
tree.add('file3')
440
354
tree.commit('add file3')
441
self.run_bzr('branch parent child')
355
self.run_bzr('branch', 'parent', 'child')
442
356
print >> file('child/file2', 'wb'), 'hello'
443
self.run_bzr(['commit', '-m', 'branch 1', 'child'])
357
self.run_bzr('commit', '-m', 'branch 1', 'child')
444
358
os.chdir('parent')
445
self.run_bzr('merge ../child')
446
self.run_bzr(['commit', '-m', 'merge child branch'])
447
log = self.run_bzr('log file1')[0]
359
self.run_bzr('merge', '../child')
360
self.run_bzr('commit', '-m', 'merge child branch')
362
log = self.run_bzr('log', 'file1')[0]
448
363
self.assertContainsRe(log, 'revno: 1\n')
449
364
self.assertNotContainsRe(log, 'revno: 2\n')
450
365
self.assertNotContainsRe(log, 'revno: 3\n')
451
366
self.assertNotContainsRe(log, 'revno: 3.1.1\n')
452
367
self.assertNotContainsRe(log, 'revno: 4\n')
453
log = self.run_bzr('log file2')[0]
368
log = self.run_bzr('log', 'file2')[0]
454
369
self.assertNotContainsRe(log, 'revno: 1\n')
455
370
self.assertContainsRe(log, 'revno: 2\n')
456
371
self.assertNotContainsRe(log, 'revno: 3\n')
457
372
self.assertContainsRe(log, 'revno: 3.1.1\n')
458
373
self.assertContainsRe(log, 'revno: 4\n')
459
log = self.run_bzr('log file3')[0]
374
log = self.run_bzr('log', 'file3')[0]
460
375
self.assertNotContainsRe(log, 'revno: 1\n')
461
376
self.assertNotContainsRe(log, 'revno: 2\n')
462
377
self.assertContainsRe(log, 'revno: 3\n')
463
378
self.assertNotContainsRe(log, 'revno: 3.1.1\n')
464
379
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')