~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-08 11:01:15 UTC
  • mfrom: (6123.1.16 gpg-typo)
  • Revision ID: pqm@cupuasso-20110908110115-gbb9benwkdksvzk5
(jelmer) Fix a typo (invalid format identifier) in an error message in
 bzrlib.gpg. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
    revision as _mod_revision,
75
75
    revisionspec,
76
76
    tsort,
 
77
    i18n,
77
78
    )
78
 
from bzrlib.i18n import gettext, ngettext
79
79
""")
80
80
 
81
81
from bzrlib import (
215
215
    Logger(branch, rqst).show(lf)
216
216
 
217
217
 
218
 
# Note: This needs to be kept in sync with the defaults in
 
218
# Note: This needs to be kept this in sync with the defaults in
219
219
# make_log_request_dict() below
220
220
_DEFAULT_REQUEST_PARAMS = {
221
221
    'direction': 'reverse',
232
232
                          delta_type=None,
233
233
                          diff_type=None, _match_using_deltas=True,
234
234
                          exclude_common_ancestry=False, match=None,
235
 
                          signature=False, omit_merges=False,
 
235
                          signature=False,
236
236
                          ):
237
237
    """Convenience function for making a logging request dictionary.
238
238
 
288
288
      revisions. Keys can be 'message', 'author', 'committer', 'bugs' or
289
289
      the empty string to match any of the preceding properties.
290
290
 
291
 
    :param omit_merges: If True, commits with more than one parent are
292
 
      omitted.
293
 
 
294
291
    """
295
292
    # Take care of old style message_search parameter
296
293
    if message_search:
314
311
        'exclude_common_ancestry': exclude_common_ancestry,
315
312
        'signature': signature,
316
313
        'match': match,
317
 
        'omit_merges': omit_merges,
318
314
        # Add 'private' attributes for features that may be deprecated
319
315
        '_match_using_deltas': _match_using_deltas,
320
316
    }
451
447
        limit = rqst.get('limit')
452
448
        diff_type = rqst.get('diff_type')
453
449
        show_signature = rqst.get('signature')
454
 
        omit_merges = rqst.get('omit_merges')
455
450
        log_count = 0
456
451
        revision_iterator = self._create_log_revision_iterator()
457
452
        for revs in revision_iterator:
459
454
                # 0 levels means show everything; merge_depth counts from 0
460
455
                if levels != 0 and merge_depth >= levels:
461
456
                    continue
462
 
                if omit_merges and len(rev.parent_ids) > 1:
463
 
                    continue
464
457
                if diff_type is None:
465
458
                    diff = None
466
459
                else:
565
558
             a list of the same tuples.
566
559
    """
567
560
    if (exclude_common_ancestry and start_rev_id == end_rev_id):
568
 
        raise errors.BzrCommandError(gettext(
569
 
            '--exclude-common-ancestry requires two different revisions'))
 
561
        raise errors.BzrCommandError(
 
562
            '--exclude-common-ancestry requires two different revisions')
570
563
    if direction not in ('reverse', 'forward'):
571
 
        raise ValueError(gettext('invalid direction %r') % direction)
 
564
        raise ValueError('invalid direction %r' % direction)
572
565
    br_revno, br_rev_id = branch.last_revision_info()
573
566
    if br_revno == 0:
574
567
        return []
615
608
        try:
616
609
            result = list(result)
617
610
        except _StartNotLinearAncestor:
618
 
            raise errors.BzrCommandError(gettext('Start revision not found in'
619
 
                ' left-hand history of end revision.'))
 
611
            raise errors.BzrCommandError('Start revision not found in'
 
612
                ' left-hand history of end revision.')
620
613
    return result
621
614
 
622
615
 
661
654
        except _StartNotLinearAncestor:
662
655
            # A merge was never detected so the lower revision limit can't
663
656
            # be nested down somewhere
664
 
            raise errors.BzrCommandError(gettext('Start revision not found in'
665
 
                ' history of end revision.'))
 
657
            raise errors.BzrCommandError('Start revision not found in'
 
658
                ' history of end revision.')
666
659
 
667
660
    # We exit the loop above because we encounter a revision with merges, from
668
661
    # this revision, we need to switch to _graph_view_revisions.
1079
1072
    if branch_revno != 0:
1080
1073
        if (start_rev_id == _mod_revision.NULL_REVISION
1081
1074
            or end_rev_id == _mod_revision.NULL_REVISION):
1082
 
            raise errors.BzrCommandError(gettext('Logging revision 0 is invalid.'))
 
1075
            raise errors.BzrCommandError('Logging revision 0 is invalid.')
1083
1076
        if start_revno > end_revno:
1084
 
            raise errors.BzrCommandError(gettext("Start revision must be "
1085
 
                                         "older than the end revision."))
 
1077
            raise errors.BzrCommandError("Start revision must be older than "
 
1078
                                         "the end revision.")
1086
1079
    return (start_rev_id, end_rev_id)
1087
1080
 
1088
1081
 
1137
1130
 
1138
1131
    if ((start_rev_id == _mod_revision.NULL_REVISION)
1139
1132
        or (end_rev_id == _mod_revision.NULL_REVISION)):
1140
 
        raise errors.BzrCommandError(gettext('Logging revision 0 is invalid.'))
 
1133
        raise errors.BzrCommandError('Logging revision 0 is invalid.')
1141
1134
    if start_revno > end_revno:
1142
 
        raise errors.BzrCommandError(gettext("Start revision must be older "
1143
 
                                     "than the end revision."))
 
1135
        raise errors.BzrCommandError("Start revision must be older than "
 
1136
                                     "the end revision.")
1144
1137
 
1145
1138
    if end_revno < start_revno:
1146
1139
        return None, None, None, None
1412
1405
            if advice_sep:
1413
1406
                self.to_file.write(advice_sep)
1414
1407
            self.to_file.write(
1415
 
                "Use --include-merged or -n0 to see merged revisions.\n")
 
1408
                "Use --include-merges or -n0 to see merged revisions.\n")
1416
1409
 
1417
1410
    def get_advice_separator(self):
1418
1411
        """Get the text separating the log from the closing advice."""
1825
1818
    try:
1826
1819
        return log_formatter_registry.make_formatter(name, *args, **kwargs)
1827
1820
    except KeyError:
1828
 
        raise errors.BzrCommandError(gettext("unknown log formatter: %r") % name)
 
1821
        raise errors.BzrCommandError("unknown log formatter: %r" % name)
1829
1822
 
1830
1823
 
1831
1824
def author_list_all(rev):
2120
2113
                          len(row) > 1 and row[1] == 'fixed']
2121
2114
 
2122
2115
        if fixed_bug_urls:
2123
 
            return {ngettext('fixes bug', 'fixes bugs', len(fixed_bug_urls)):\
2124
 
                    ' '.join(fixed_bug_urls)}
 
2116
            return {'fixes bug(s)': ' '.join(fixed_bug_urls)}
2125
2117
    return {}
2126
2118
 
2127
2119
properties_handler_registry.register('bugs_properties_handler',