618
618
from bzrlib.osutils import format_date
619
619
indent = ' ' * revision.merge_depth
620
620
to_file = self.to_file
621
print >>to_file, indent + '-' * 60
621
to_file.write(indent + '-' * 60 + '\n')
622
622
if revision.revno is not None:
623
print >>to_file, indent + 'revno:', revision.revno
623
to_file.write(indent + 'revno: ' + revision.revno + '\n')
624
624
if revision.tags:
625
print >>to_file, indent + 'tags: %s' % (', '.join(revision.tags))
625
to_file.write(indent + 'tags: %s\n' % (', '.join(revision.tags)))
626
626
if self.show_ids:
627
print >>to_file, indent + 'revision-id:', revision.rev.revision_id
627
to_file.write(indent + 'revision-id:' + revision.rev.revision_id)
628
629
for parent_id in revision.rev.parent_ids:
629
print >>to_file, indent + 'parent:', parent_id
630
to_file.write(indent + 'parent:' + parent_id + '\n')
631
632
author = revision.rev.properties.get('author', None)
632
633
if author is not None:
633
print >>to_file, indent + 'author:', author
634
print >>to_file, indent + 'committer:', revision.rev.committer
634
to_file.write(indent + 'author:' + author+ '\n')
635
to_file.write(indent + 'committer:' + revision.rev.committer + '\n')
636
637
branch_nick = revision.rev.properties.get('branch-nick', None)
637
638
if branch_nick is not None:
638
print >>to_file, indent + 'branch nick:', branch_nick
639
to_file.write(indent + 'branch nick:' + branch_nick+ '\n')
640
641
date_str = format_date(revision.rev.timestamp,
641
642
revision.rev.timezone or 0,
642
643
self.show_timezone)
643
print >>to_file, indent + 'timestamp: %s' % date_str
644
to_file.write(indent + 'timestamp: %s\n' % date_str)
645
print >>to_file, indent + 'message:'
646
to_file.write(indent + 'message:\n')
646
647
if not revision.rev.message:
647
print >>to_file, indent + ' (no message)'
648
to_file.write(indent + ' (no message)\n')
649
650
message = revision.rev.message.rstrip('\r\n')
650
651
for l in message.split('\n'):
651
print >>to_file, indent + ' ' + l
652
to_file.write(indent + ' ' + l + '\n')
652
653
if revision.delta is not None:
653
654
revision.delta.show(to_file, self.show_ids, indent=indent)
673
674
if len(revision.rev.parent_ids) > 1:
674
675
is_merge = ' [merge]'
675
print >>to_file, "%5s %s\t%s%s" % (revision.revno,
676
to_file.write("%5s %s\t%s%s\n" % (revision.revno,
676
677
self.short_author(revision.rev),
677
678
format_date(revision.rev.timestamp,
678
679
revision.rev.timezone or 0,
679
680
self.show_timezone, date_fmt="%Y-%m-%d",
680
681
show_offset=False),
682
683
if self.show_ids:
683
print >>to_file, ' revision-id:', revision.rev.revision_id
684
to_file.write(' revision-id:' + revision.rev.revision_id + '\n')
684
685
if not revision.rev.message:
685
print >>to_file, ' (no message)'
686
to_file.write(' (no message)\n')
687
688
message = revision.rev.message.rstrip('\r\n')
688
689
for l in message.split('\n'):
689
print >>to_file, ' ' + l
690
to_file.write(' ' + l + '\n')
691
692
# TODO: Why not show the modified files in a shorter form as
692
693
# well? rewrap them single lines of appropriate length
693
694
if revision.delta is not None:
694
695
revision.delta.show(to_file, self.show_ids)
698
699
class LineLogFormatter(LogFormatter):
722
723
@deprecated_method(zero_seventeen)
723
724
def show(self, revno, rev, delta):
724
725
from bzrlib.osutils import terminal_width
725
print >> self.to_file, self.log_string(revno, rev, terminal_width()-1)
726
self.to_file.write(self.log_string(revno, rev, terminal_width()-1))
727
self.to_file.write('\n')
727
729
def log_revision(self, revision):
728
print >>self.to_file, self.log_string(revision.revno, revision.rev,
730
self.to_file.write(self.log_string(revision.revno, revision.rev,
732
self.to_file.write('\n')
731
734
def log_string(self, revno, rev, max_chars):
732
735
"""Format log info into one string. Truncate tail of string