293
def _prepare_tree_with_merges(self, with_tags=False):
294
wt = self.make_branch_and_memory_tree('.')
296
self.addCleanup(wt.unlock)
298
wt.commit('rev-1', rev_id='rev-1',
299
timestamp=1132586655, timezone=36000,
300
committer='Joe Foo <joe@foo.com>')
301
wt.commit('rev-merged', rev_id='rev-2a',
302
timestamp=1132586700, timezone=36000,
303
committer='Joe Foo <joe@foo.com>')
304
wt.set_parent_ids(['rev-1', 'rev-2a'])
305
wt.branch.set_last_revision_info(1, 'rev-1')
306
wt.commit('rev-2', rev_id='rev-2b',
307
timestamp=1132586800, timezone=36000,
308
committer='Joe Foo <joe@foo.com>')
311
branch.tags.set_tag('v0.2', 'rev-2b')
312
wt.commit('rev-3', rev_id='rev-3',
313
timestamp=1132586900, timezone=36000,
314
committer='Jane Foo <jane@foo.com>')
315
branch.tags.set_tag('v1.0rc1', 'rev-3')
316
branch.tags.set_tag('v1.0', 'rev-3')
293
319
def test_short_log_with_merges(self):
294
wt = self.make_branch_and_memory_tree('.')
296
self.addCleanup(wt.unlock)
298
wt.commit('rev-1', rev_id='rev-1',
299
timestamp=1132586655, timezone=36000,
300
committer='Joe Foo <joe@foo.com>')
301
wt.commit('rev-merged', rev_id='rev-2a',
302
timestamp=1132586700, timezone=36000,
303
committer='Joe Foo <joe@foo.com>')
304
wt.set_parent_ids(['rev-1', 'rev-2a'])
305
wt.branch.set_last_revision_info(1, 'rev-1')
306
wt.commit('rev-2', rev_id='rev-2b',
307
timestamp=1132586800, timezone=36000,
308
committer='Joe Foo <joe@foo.com>')
320
wt = self._prepare_tree_with_merges()
309
321
logfile = self.make_utf8_encoded_stringio()
310
322
formatter = log.ShortLogFormatter(to_file=logfile)
311
323
log.show_log(wt.branch, formatter)
320
332
logfile.getvalue())
334
def test_short_log_with_tags(self):
335
wt = self._prepare_tree_with_merges(with_tags=True)
336
logfile = self.make_utf8_encoded_stringio()
337
formatter = log.ShortLogFormatter(to_file=logfile)
338
log.show_log(wt.branch, formatter)
339
self.assertEqualDiff("""\
340
3 Jane Foo\t2005-11-22 {v1.0, v1.0rc1}
343
2 Joe Foo\t2005-11-22 {v0.2} [merge]
346
1 Joe Foo\t2005-11-22
322
352
def test_short_log_single_merge_revision(self):
323
353
wt = self.make_branch_and_memory_tree('.')
734
def _prepare_tree_with_merges(self, with_tags=False):
735
wt = self.make_branch_and_memory_tree('.')
737
self.addCleanup(wt.unlock)
739
wt.commit('rev-1', rev_id='rev-1',
740
timestamp=1132586655, timezone=36000,
741
committer='Joe Foo <joe@foo.com>')
742
wt.commit('rev-merged', rev_id='rev-2a',
743
timestamp=1132586700, timezone=36000,
744
committer='Joe Foo <joe@foo.com>')
745
wt.set_parent_ids(['rev-1', 'rev-2a'])
746
wt.branch.set_last_revision_info(1, 'rev-1')
747
wt.commit('rev-2', rev_id='rev-2b',
748
timestamp=1132586800, timezone=36000,
749
committer='Joe Foo <joe@foo.com>')
752
branch.tags.set_tag('v0.2', 'rev-2b')
753
wt.commit('rev-3', rev_id='rev-3',
754
timestamp=1132586900, timezone=36000,
755
committer='Jane Foo <jane@foo.com>')
756
branch.tags.set_tag('v1.0rc1', 'rev-3')
757
branch.tags.set_tag('v1.0', 'rev-3')
704
760
def test_line_log_single_merge_revision(self):
705
wt = self.make_branch_and_memory_tree('.')
707
self.addCleanup(wt.unlock)
709
wt.commit('rev-1', rev_id='rev-1',
710
timestamp=1132586655, timezone=36000,
711
committer='Joe Foo <joe@foo.com>')
712
wt.commit('rev-merged', rev_id='rev-2a',
713
timestamp=1132586700, timezone=36000,
714
committer='Joe Foo <joe@foo.com>')
715
wt.set_parent_ids(['rev-1', 'rev-2a'])
716
wt.branch.set_last_revision_info(1, 'rev-1')
717
wt.commit('rev-2', rev_id='rev-2b',
718
timestamp=1132586800, timezone=36000,
719
committer='Joe Foo <joe@foo.com>')
761
wt = self._prepare_tree_with_merges()
720
762
logfile = self.make_utf8_encoded_stringio()
721
763
formatter = log.LineLogFormatter(to_file=logfile)
722
764
revspec = revisionspec.RevisionSpec.from_string('1.1.1')
729
771
logfile.getvalue())
773
def test_line_log_with_tags(self):
774
wt = self._prepare_tree_with_merges(with_tags=True)
775
logfile = self.make_utf8_encoded_stringio()
776
formatter = log.LineLogFormatter(to_file=logfile)
777
log.show_log(wt.branch, formatter)
778
self.assertEqualDiff("""\
779
3{v1.0, v1.0rc1}: Jane Foo 2005-11-22 rev-3
780
2{v0.2}: Joe Foo 2005-11-22 rev-2
781
1: Joe Foo 2005-11-22 rev-1
733
786
class TestGetViewRevisions(tests.TestCaseWithTransport):