148
148
"""Write out human-readable log of commits to this branch.
151
LogFormatter object to show the output.
154
If true, list only the commits affecting the specified
155
file, rather than all commits.
158
If true show added/changed/deleted/renamed files.
161
'reverse' (default) is latest to earliest;
162
'forward' is earliest to latest.
165
If not None, only show revisions >= start_revision
168
If not None, only show revisions <= end_revision
171
If not None, only show revisions with matching commit messages
174
If not None or 0, only show limit revisions
150
:param lf: The LogFormatter object showing the output.
152
:param specific_fileid: If not None, list only the commits affecting the
153
specified file, rather than all commits.
155
:param verbose: If True show added/changed/deleted/renamed files.
157
:param direction: 'reverse' (default) is latest to earliest; 'forward' is
160
:param start_revision: If not None, only show revisions >= start_revision
162
:param end_revision: If not None, only show revisions <= end_revision
164
:param search: If not None, only show revisions with matching commit
167
:param limit: If set, shows only 'limit' revisions, all revisions are shown
176
170
branch.lock_read()
398
392
:param search: A user text search string.
399
393
:param log_rev_iterator: An input iterator containing all revisions that
400
394
could be displayed, in lists.
401
:return: An iterator over lists of ((rev_id, revno, merge_depth), rev, delta).
395
:return: An iterator over lists of ((rev_id, revno, merge_depth), rev,
403
398
repository = branch.repository
649
644
elif direction != 'reverse':
650
645
raise ValueError('invalid direction %r' % direction)
652
for sequence, rev_id, merge_depth, revno, end_of_merge in merge_sorted_revisions:
647
for (sequence, rev_id, merge_depth, revno, end_of_merge
648
) in merge_sorted_revisions:
653
649
yield rev_id, '.'.join(map(str, revno)), merge_depth
713
709
to indicate which LogRevision attributes it supports:
715
711
- supports_delta must be True if this log formatter supports delta.
716
Otherwise the delta attribute may not be populated.
712
Otherwise the delta attribute may not be populated. The 'delta_format'
713
attribute describes whether the 'short_status' format (1) or the long
714
one (2) sould be used.
717
716
- supports_merge_revisions must be True if this log formatter supports
718
717
merge revisions. If not, and if supports_single_merge_revisions is
719
718
also not True, then only mainline revisions will be passed to the
735
def __init__(self, to_file, show_ids=False, show_timezone='original'):
734
def __init__(self, to_file, show_ids=False, show_timezone='original',
736
736
self.to_file = to_file
737
737
self.show_ids = show_ids
738
738
self.show_timezone = show_timezone
739
if delta_format is None:
740
# Ensures backward compatibility
741
delta_format = 2 # long format
742
self.delta_format = delta_format
740
744
# TODO: uncomment this block after show() has been removed.
741
745
# Until then defining log_revision would prevent _show_log calling show()
813
817
for l in message.split('\n'):
814
818
to_file.write(indent + ' %s\n' % (l,))
815
819
if revision.delta is not None:
816
revision.delta.show(to_file, self.show_ids, indent=indent)
820
# We don't respect delta_format for compatibility
821
revision.delta.show(to_file, self.show_ids, indent=indent,
819
825
class ShortLogFormatter(LogFormatter):
834
840
show_offset=False),
836
842
if self.show_ids:
837
to_file.write(' revision-id:%s\n' % (revision.rev.revision_id,))
843
to_file.write(' revision-id:%s\n'
844
% (revision.rev.revision_id,))
838
845
if not revision.rev.message:
839
846
to_file.write(' (no message)\n')
842
849
for l in message.split('\n'):
843
850
to_file.write(' %s\n' % (l,))
845
# TODO: Why not show the modified files in a shorter form as
846
# well? rewrap them single lines of appropriate length
847
852
if revision.delta is not None:
848
revision.delta.show(to_file, self.show_ids)
853
revision.delta.show(to_file, self.show_ids,
854
short_status=self.delta_format==1)
849
855
to_file.write('\n')