~jeanfrancois.roy/bzr/url-safe-escape

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Mark Hammond
  • Date: 2008-12-28 05:21:23 UTC
  • mfrom: (3920 +trunk)
  • mto: (3932.1.1 prepare-1.11)
  • mto: This revision was merged to the branch mainline in revision 3937.
  • Revision ID: mhammond@skippinet.com.au-20081228052123-f78xs5sbdkotshwf
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
147
147
             limit=None):
148
148
    """Write out human-readable log of commits to this branch.
149
149
 
150
 
    lf
151
 
        LogFormatter object to show the output.
152
 
 
153
 
    specific_fileid
154
 
        If true, list only the commits affecting the specified
155
 
        file, rather than all commits.
156
 
 
157
 
    verbose
158
 
        If true show added/changed/deleted/renamed files.
159
 
 
160
 
    direction
161
 
        'reverse' (default) is latest to earliest;
162
 
        'forward' is earliest to latest.
163
 
 
164
 
    start_revision
165
 
        If not None, only show revisions >= start_revision
166
 
 
167
 
    end_revision
168
 
        If not None, only show revisions <= end_revision
169
 
 
170
 
    search
171
 
        If not None, only show revisions with matching commit messages
172
 
 
173
 
    limit
174
 
        If not None or 0, only show limit revisions
 
150
    :param lf: The LogFormatter object showing the output.
 
151
 
 
152
    :param specific_fileid: If not None, list only the commits affecting the
 
153
        specified file, rather than all commits.
 
154
 
 
155
    :param verbose: If True show added/changed/deleted/renamed files.
 
156
 
 
157
    :param direction: 'reverse' (default) is latest to earliest; 'forward' is
 
158
        earliest to latest.
 
159
 
 
160
    :param start_revision: If not None, only show revisions >= start_revision
 
161
 
 
162
    :param end_revision: If not None, only show revisions <= end_revision
 
163
 
 
164
    :param search: If not None, only show revisions with matching commit
 
165
        messages
 
166
 
 
167
    :param limit: If set, shows only 'limit' revisions, all revisions are shown
 
168
        if None or 0.
175
169
    """
176
170
    branch.lock_read()
177
171
    try:
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,
 
396
        delta).
402
397
    """
403
398
    repository = branch.repository
404
399
    num = 9
649
644
    elif direction != 'reverse':
650
645
        raise ValueError('invalid direction %r' % direction)
651
646
 
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
654
650
 
655
651
 
713
709
    to indicate which LogRevision attributes it supports:
714
710
 
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.
 
715
 
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 
732
731
            # to be shown
733
732
    """
734
733
 
735
 
    def __init__(self, to_file, show_ids=False, show_timezone='original'):
 
734
    def __init__(self, to_file, show_ids=False, show_timezone='original',
 
735
                 delta_format=None):
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
739
743
 
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,
 
822
                                short_status=False)
817
823
 
818
824
 
819
825
class ShortLogFormatter(LogFormatter):
834
840
                            show_offset=False),
835
841
                is_merge))
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')
840
847
        else:
842
849
            for l in message.split('\n'):
843
850
                to_file.write('      %s\n' % (l,))
844
851
 
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')
850
856
 
851
857