91
91
self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
92
92
start_revision=1, end_revision=-1)
94
def test_cur_revno(self):
95
wt = self.make_branch_and_tree('.')
99
wt.commit('empty commit')
100
show_log(b, lf, verbose=True, start_revision=1, end_revision=1)
101
self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
102
start_revision=2, end_revision=1)
103
self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
104
start_revision=1, end_revision=2)
105
self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
106
start_revision=0, end_revision=2)
107
self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
108
start_revision=1, end_revision=0)
109
self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
110
start_revision=-1, end_revision=1)
111
self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
112
start_revision=1, end_revision=-1)
94
114
def test_simple_log(self):
95
115
eq = self.assertEquals
324
343
wt.merge_from_branch(tree2.branch)
325
344
wt.commit('four-b', rev_id='4b')
326
345
mainline_revs = [None, '1', '2', '3c', '4b']
327
rev_nos = {'1':1, '2':2, '3c': 3, '4b':4}
328
full_rev_nos_for_reference = {
331
'3a': '2.2.1', #first commit tree 3
332
'3b': '2.1.1', # first commit tree 2
333
'3c': '3', #merges 3b to main
334
'4a': '2.1.2', # second commit tree 2
335
'4b': '4', # merges 4a to main
346
rev_nos = {'1': 1, '2': 2, '3c': 3, '4b': 4}
337
347
return mainline_revs, rev_nos, wt
339
349
def test_get_view_revisions_forward(self):
352
361
mainline_revs, rev_nos, wt = self.make_tree_with_commits()
353
362
revisions = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
355
self.assertEqual([('3', '3', 0), ('2', '2', 0), ('1', '1', 0), ],
364
self.assertEqual(revisions, [('3', 3, 0), ('2', 2, 0), ('1', 1, 0), ])
357
365
revisions2 = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
358
366
'reverse', include_merges=False))
359
367
self.assertEqual(revisions, revisions2)
363
371
mainline_revs, rev_nos, wt = self.make_tree_with_merges()
364
372
revisions = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
366
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0),
367
('4b', '4', 0), ('4a', '3.1.1', 1)],
374
self.assertEqual(revisions, [('1', 1, 0), ('2', 2, 0), ('3', 3, 0),
375
('4b', 4, 0), ('4a', None, 1)])
369
376
revisions = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
370
377
'forward', include_merges=False))
371
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0),
378
self.assertEqual(revisions, [('1', 1, 0), ('2', 2, 0), ('3', 3, 0),
375
381
def test_get_view_revisions_merge_reverse(self):
376
382
"""Test get_view_revisions in reverse when there are merges"""
377
383
mainline_revs, rev_nos, wt = self.make_tree_with_merges()
378
384
revisions = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
380
self.assertEqual([('4b', '4', 0), ('4a', '3.1.1', 1),
381
('3', '3', 0), ('2', '2', 0), ('1', '1', 0)],
386
self.assertEqual(revisions, [('4b', 4, 0), ('4a', None, 1),
387
('3', 3, 0), ('2', 2, 0), ('1', 1, 0)])
383
388
revisions = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
384
389
'reverse', include_merges=False))
385
self.assertEqual([('4b', '4', 0), ('3', '3', 0), ('2', '2', 0),
390
self.assertEqual(revisions, [('4b', 4, 0), ('3', 3, 0), ('2', 2, 0),
389
393
def test_get_view_revisions_merge2(self):
390
394
"""Test get_view_revisions when there are merges"""
391
395
mainline_revs, rev_nos, wt = self.make_tree_with_many_merges()
392
396
revisions = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
394
expected = [('1', '1', 0), ('2', '2', 0), ('3c', '3', 0),
395
('3a', '2.2.1', 1), ('3b', '2.1.1', 1), ('4b', '4', 0),
397
self.assertEqual(expected, revisions)
398
expected = [('1', 1, 0), ('2', 2, 0), ('3c', 3, 0), ('3a', None, 1),
399
('3b', None, 1), ('4b', 4, 0), ('4a', None, 1)]
400
self.assertEqual(revisions, expected)
398
401
revisions = list(get_view_revisions(mainline_revs, rev_nos, wt.branch,
399
402
'forward', include_merges=False))
400
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3c', '3', 0),
403
self.assertEqual(revisions, [('1', 1, 0), ('2', 2, 0), ('3c', 3, 0),