13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
from cStringIO import StringIO
198
198
self.assertEqual('add file1 and file2', logentry.rev.message)
199
199
self.checkDelta(logentry.delta, added=['file1', 'file2'])
201
def test_merges_nonsupporting_formatter(self):
202
"""Tests that show_log will raise if the formatter doesn't
203
support merge revisions."""
204
wt = self.make_branch_and_memory_tree('.')
206
self.addCleanup(wt.unlock)
208
wt.commit('rev-1', rev_id='rev-1',
209
timestamp=1132586655, timezone=36000,
210
committer='Joe Foo <joe@foo.com>')
211
wt.commit('rev-merged', rev_id='rev-2a',
212
timestamp=1132586700, timezone=36000,
213
committer='Joe Foo <joe@foo.com>')
214
wt.set_parent_ids(['rev-1', 'rev-2a'])
215
wt.branch.set_last_revision_info(1, 'rev-1')
216
wt.commit('rev-2', rev_id='rev-2b',
217
timestamp=1132586800, timezone=36000,
218
committer='Joe Foo <joe@foo.com>')
219
logfile = self.make_utf8_encoded_stringio()
220
formatter = log.ShortLogFormatter(to_file=logfile)
223
revspec = revisionspec.RevisionSpec.from_string('1.1.1')
224
rev = revspec.in_history(wtb)
225
self.assertRaises(errors.BzrCommandError, log.show_log, wtb, lf,
226
start_revision=rev, end_revision=rev)
202
229
def make_commits_with_trailing_newlines(wt):
203
230
"""Helper method for LogFormatter tests"""
512
536
wt.commit('merge branch 1')
514
538
sio = self.make_utf8_encoded_stringio()
515
lf = log.LongLogFormatter(to_file=sio, levels=0)
539
lf = log.LongLogFormatter(to_file=sio)
516
540
log.show_log(b, lf, verbose=True)
517
541
the_log = normalize_log(sio.getvalue())
518
542
self.assertEqualDiff("""\
519
543
------------------------------------------------------------
521
545
committer: Lorem Ipsum <test@example.com>
522
546
branch nick: parent
523
547
timestamp: Just now
526
550
------------------------------------------------------------
528
552
committer: Lorem Ipsum <test@example.com>
529
553
branch nick: child
530
554
timestamp: Just now
569
593
wt.commit('merge branch 1')
571
595
sio = self.make_utf8_encoded_stringio()
572
lf = log.LongLogFormatter(to_file=sio, levels=0)
596
lf = log.LongLogFormatter(to_file=sio)
573
597
log.show_log(b, lf, verbose=True)
574
598
the_log = normalize_log(sio.getvalue())
575
599
self.assertEqualDiff("""\
576
600
------------------------------------------------------------
578
602
committer: Lorem Ipsum <test@example.com>
579
603
branch nick: parent
580
604
timestamp: Just now
1476
1499
self.assertAllRevisionsForFileID(tree, 'f1-id', ['XX', 'B', 'A'])
1477
1500
self.assertAllRevisionsForFileID(tree, 'f2-id', ['D', 'C', 'A'])
1479
def test_unknown_file_id(self):
1480
tree = self.create_tree_with_single_merge()
1481
self.assertAllRevisionsForFileID(tree, 'unknown', [])
1483
def test_empty_branch_unknown_file_id(self):
1484
tree = self.make_branch_and_tree('tree')
1485
self.assertAllRevisionsForFileID(tree, 'unknown', [])
1488
1503
class TestShowChangedRevisions(tests.TestCaseWithTransport):