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)
358
370
logfile.getvalue())
372
def test_short_log_with_tags(self):
373
wt = self._prepare_tree_with_merges(with_tags=True)
374
logfile = self.make_utf8_encoded_stringio()
375
formatter = log.ShortLogFormatter(to_file=logfile)
376
log.show_log(wt.branch, formatter)
377
self.assertEqualDiff("""\
378
3 Jane Foo\t2005-11-22 {v1.0, v1.0rc1}
381
2 Joe Foo\t2005-11-22 {v0.2} [merge]
384
1 Joe Foo\t2005-11-22
360
390
def test_short_log_single_merge_revision(self):
361
391
wt = self.make_branch_and_memory_tree('.')
772
def _prepare_tree_with_merges(self, with_tags=False):
773
wt = self.make_branch_and_memory_tree('.')
775
self.addCleanup(wt.unlock)
777
wt.commit('rev-1', rev_id='rev-1',
778
timestamp=1132586655, timezone=36000,
779
committer='Joe Foo <joe@foo.com>')
780
wt.commit('rev-merged', rev_id='rev-2a',
781
timestamp=1132586700, timezone=36000,
782
committer='Joe Foo <joe@foo.com>')
783
wt.set_parent_ids(['rev-1', 'rev-2a'])
784
wt.branch.set_last_revision_info(1, 'rev-1')
785
wt.commit('rev-2', rev_id='rev-2b',
786
timestamp=1132586800, timezone=36000,
787
committer='Joe Foo <joe@foo.com>')
790
branch.tags.set_tag('v0.2', 'rev-2b')
791
wt.commit('rev-3', rev_id='rev-3',
792
timestamp=1132586900, timezone=36000,
793
committer='Jane Foo <jane@foo.com>')
794
branch.tags.set_tag('v1.0rc1', 'rev-3')
795
branch.tags.set_tag('v1.0', 'rev-3')
742
798
def test_line_log_single_merge_revision(self):
743
wt = self.make_branch_and_memory_tree('.')
745
self.addCleanup(wt.unlock)
747
wt.commit('rev-1', rev_id='rev-1',
748
timestamp=1132586655, timezone=36000,
749
committer='Joe Foo <joe@foo.com>')
750
wt.commit('rev-merged', rev_id='rev-2a',
751
timestamp=1132586700, timezone=36000,
752
committer='Joe Foo <joe@foo.com>')
753
wt.set_parent_ids(['rev-1', 'rev-2a'])
754
wt.branch.set_last_revision_info(1, 'rev-1')
755
wt.commit('rev-2', rev_id='rev-2b',
756
timestamp=1132586800, timezone=36000,
757
committer='Joe Foo <joe@foo.com>')
799
wt = self._prepare_tree_with_merges()
758
800
logfile = self.make_utf8_encoded_stringio()
759
801
formatter = log.LineLogFormatter(to_file=logfile)
760
802
revspec = revisionspec.RevisionSpec.from_string('1.1.1')
767
809
logfile.getvalue())
811
def test_line_log_with_tags(self):
812
wt = self._prepare_tree_with_merges(with_tags=True)
813
logfile = self.make_utf8_encoded_stringio()
814
formatter = log.LineLogFormatter(to_file=logfile)
815
log.show_log(wt.branch, formatter)
816
self.assertEqualDiff("""\
817
3: Jane Foo 2005-11-22 {v1.0, v1.0rc1} rev-3
818
2: Joe Foo 2005-11-22 {v0.2} rev-2
819
1: Joe Foo 2005-11-22 rev-1
771
824
class TestGetViewRevisions(tests.TestCaseWithTransport):