43
43
In verbose mode we show a summary of what changed in each particular
44
44
revision. Note that this is the delta for changes in that revision
45
relative to its mainline parent, not the delta relative to the last
45
relative to its left-most parent, not the delta relative to the last
46
46
logged revision. So for example if you ask for a verbose log of
47
47
changes touching hello.c you will get a list of those revisions also
48
48
listing other things that were changed in the same revision, but not
49
49
all the changes since the previous revision that touched hello.c.
52
# TODO: option to show delta summaries for merged-in revisions
54
52
from itertools import izip
243
# rebase merge_depth - unless there are no revisions or
244
# either the first or last revision have merge_depth = 0.
245
if view_revisions and view_revisions[0][2] and view_revisions[-1][2]:
246
min_depth = min([d for r,n,d in view_revisions])
248
view_revisions = [(r,n,d-min_depth) for r,n,d in view_revisions]
246
250
rev_tag_dict = {}
247
251
generate_tags = getattr(lf, 'supports_tags', False)
248
252
if generate_tags:
560
564
- supports_delta must be True if this log formatter supports delta.
561
565
Otherwise the delta attribute may not be populated.
562
566
- supports_merge_revisions must be True if this log formatter supports
563
merge revisions. If not, only revisions mainline revisions (those
567
merge revisions. If not, only mainline revisions (those
564
568
with merge_depth == 0) will be passed to the formatter.
565
569
- supports_tags must be True if this log formatter supports tags.
566
570
Otherwise the tags attribute may not be populated.
600
607
lr = LogRevision(rev, revno, 0, delta, tags)
601
608
return self.log_revision(lr)
603
@deprecated_method(zero_eleven)
604
def show_merge(self, rev, merge_depth):
605
lr = LogRevision(rev, merge_depth=merge_depth)
606
return self.log_revision(lr)
608
610
@deprecated_method(zero_seventeen)
609
611
def show_merge_revno(self, rev, merge_depth, revno, tags=None):
610
612
"""Show a merged revision rev, with merge_depth and a revno."""
614
616
def log_revision(self, revision):
615
617
"""Log a revision, either merged or not."""
616
618
from bzrlib.osutils import format_date
617
indent = ' '*revision.merge_depth
619
indent = ' ' * revision.merge_depth
618
620
to_file = self.to_file
619
print >>to_file, indent+'-' * 60
621
print >>to_file, indent + '-' * 60
620
622
if revision.revno is not None:
621
print >>to_file, indent+'revno:', revision.revno
623
print >>to_file, indent + 'revno:', revision.revno
622
624
if revision.tags:
623
print >>to_file, indent+'tags: %s' % (', '.join(revision.tags))
625
print >>to_file, indent + 'tags: %s' % (', '.join(revision.tags))
624
626
if self.show_ids:
625
print >>to_file, indent+'revision-id:', revision.rev.revision_id
627
print >>to_file, indent + 'revision-id:', revision.rev.revision_id
626
628
for parent_id in revision.rev.parent_ids:
627
print >>to_file, indent+'parent:', parent_id
628
print >>to_file, indent+'committer:', revision.rev.committer
631
print >>to_file, indent+'branch nick: %s' % \
632
revision.rev.properties['branch-nick']
629
print >>to_file, indent + 'parent:', parent_id
631
author = revision.rev.properties.get('author', None)
632
if author is not None:
633
print >>to_file, indent + 'author:', author
634
print >>to_file, indent + 'committer:', revision.rev.committer
636
branch_nick = revision.rev.properties.get('branch-nick', None)
637
if branch_nick is not None:
638
print >>to_file, indent + 'branch nick:', branch_nick
635
640
date_str = format_date(revision.rev.timestamp,
636
641
revision.rev.timezone or 0,
637
642
self.show_timezone)
638
print >>to_file, indent+'timestamp: %s' % date_str
643
print >>to_file, indent + 'timestamp: %s' % date_str
640
print >>to_file, indent+'message:'
645
print >>to_file, indent + 'message:'
641
646
if not revision.rev.message:
642
print >>to_file, indent+' (no message)'
647
print >>to_file, indent + ' (no message)'
644
649
message = revision.rev.message.rstrip('\r\n')
645
650
for l in message.split('\n'):
646
print >>to_file, indent+' ' + l
651
print >>to_file, indent + ' ' + l
647
652
if revision.delta is not None:
648
653
revision.delta.show(to_file, self.show_ids, indent=indent)
668
673
if len(revision.rev.parent_ids) > 1:
669
674
is_merge = ' [merge]'
670
675
print >>to_file, "%5s %s\t%s%s" % (revision.revno,
671
self.short_committer(revision.rev),
676
self.short_author(revision.rev),
672
677
format_date(revision.rev.timestamp,
673
678
revision.rev.timezone or 0,
674
679
self.show_timezone, date_fmt="%Y-%m-%d",
795
800
lf.show(revno, rev, delta)
798
def show_changed_revisions(branch, old_rh, new_rh, to_file=None, log_format='long'):
803
def show_changed_revisions(branch, old_rh, new_rh, to_file=None,
799
805
"""Show the change in revision history comparing the old revision history to the new one.
801
807
:param branch: The branch where the revisions exist