/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/log.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-12 01:41:38 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181112014138-3b0zyx91cu3wdq3k
More PEP8 fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    diff,
67
67
    foreign,
68
68
    revision as _mod_revision,
69
 
    tsort,
70
69
    )
71
70
from breezy.i18n import gettext, ngettext
72
71
""")
462
461
        for revs in revision_iterator:
463
462
            for (rev_id, revno, merge_depth), rev, delta in revs:
464
463
                # 0 levels means show everything; merge_depth counts from 0
465
 
                if levels != 0 and merge_depth is not None and merge_depth >= levels:
 
464
                if (levels != 0 and merge_depth is not None and
 
465
                        merge_depth >= levels):
466
466
                    continue
467
467
                if omit_merges and len(rev.parent_ids) > 1:
468
468
                    continue
476
476
                    signature = format_signature_validity(rev_id, self.branch)
477
477
                else:
478
478
                    signature = None
479
 
                yield LogRevision(rev, revno, merge_depth, delta,
480
 
                                  self.rev_tag_dict.get(rev_id), diff, signature)
 
479
                yield LogRevision(
 
480
                    rev, revno, merge_depth, delta,
 
481
                    self.rev_tag_dict.get(rev_id), diff, signature)
481
482
                if limit:
482
483
                    log_count += 1
483
484
                    if log_count >= limit:
519
520
            # not a directory
520
521
            file_count = len(self.rqst.get('specific_fileids'))
521
522
            if file_count != 1:
522
 
                raise BzrError("illegal LogRequest: must match-using-deltas "
523
 
                               "when logging %d files" % file_count)
 
523
                raise errors.BzrError(
 
524
                    "illegal LogRequest: must match-using-deltas "
 
525
                    "when logging %d files" % file_count)
524
526
            return self._log_revision_iterator_using_per_file_graph()
525
527
 
526
528
    def _log_revision_iterator_using_delta_matching(self):
582
584
 
583
585
    if (end_rev_id and start_rev_id == end_rev_id
584
586
        and (not generate_merge_revisions
585
 
         or not _has_merges(branch, end_rev_id))):
 
587
             or not _has_merges(branch, end_rev_id))):
586
588
        # If a single revision is requested, check we can handle it
587
589
        return _generate_one_revision(branch, end_rev_id, br_rev_id,
588
590
                                      branch.revno())
880
882
        # It would be nicer if log adapters were first class objects
881
883
        # with custom parameters. This will do for now. IGC 20090127
882
884
        if adapter == _make_delta_filter:
883
 
            log_rev_iterator = adapter(branch, generate_delta,
884
 
                                       search, log_rev_iterator, file_ids, direction)
 
885
            log_rev_iterator = adapter(
 
886
                branch, generate_delta, search, log_rev_iterator, file_ids,
 
887
                direction)
885
888
        else:
886
 
            log_rev_iterator = adapter(branch, generate_delta,
887
 
                                       search, log_rev_iterator)
 
889
            log_rev_iterator = adapter(
 
890
                branch, generate_delta, search, log_rev_iterator)
888
891
    return log_rev_iterator
889
892
 
890
893
 
1111
1114
            raise errors.BzrCommandError(
1112
1115
                gettext('Logging revision 0 is invalid.'))
1113
1116
        if end_revno is not None and start_revno > end_revno:
1114
 
            raise errors.BzrCommandError(gettext("Start revision must be "
1115
 
                                                 "older than the end revision."))
 
1117
            raise errors.BzrCommandError(
 
1118
                gettext("Start revision must be older than the end revision."))
1116
1119
    return (start_rev_id, end_rev_id)
1117
1120
 
1118
1121
 
1287
1290
    """Reverse revisions by depth.
1288
1291
 
1289
1292
    Revisions with a different depth are sorted as a group with the previous
1290
 
    revision of that depth.  There may be no topological justification for this,
 
1293
    revision of that depth.  There may be no topological justification for this
1291
1294
    but it looks much nicer.
1292
1295
    """
1293
1296
    # Add a fake revision at start so that we can always attach sub revisions
1400
1403
        """
1401
1404
        self.to_file = to_file
1402
1405
        # 'exact' stream used to show diff, it should print content 'as is'
1403
 
        # and should not try to decode/encode it to unicode to avoid bug #328007
 
1406
        # and should not try to decode/encode it to unicode to avoid bug
 
1407
        # #328007
1404
1408
        if to_exact_file is not None:
1405
1409
            self.to_exact_file = to_exact_file
1406
1410
        else:
1407
 
            # XXX: somewhat hacky; this assumes it's a codec writer; it's better
1408
 
            # for code that expects to get diffs to pass in the exact file
1409
 
            # stream
 
1411
            # XXX: somewhat hacky; this assumes it's a codec writer; it's
 
1412
            # better for code that expects to get diffs to pass in the exact
 
1413
            # file stream
1410
1414
            self.to_exact_file = getattr(to_file, 'stream', to_file)
1411
1415
        self.show_ids = show_ids
1412
1416
        self.show_timezone = show_timezone
1530
1534
                rev.mapping.vcs.show_foreign_revid(rev.foreign_revid))
1531
1535
 
1532
1536
        # Imported foreign revision revision ids always contain :
1533
 
        if not b":" in rev.revision_id:
 
1537
        if b":" not in rev.revision_id:
1534
1538
            return []
1535
1539
 
1536
1540
        # Revision was once imported from a foreign repository
2035
2039
    :param last_revno: The revno of the last revision_id in the history.
2036
2040
    :param lf: The log formatter to use.
2037
2041
    """
2038
 
    start_revno = last_revno - len(history) + 1
2039
2042
    revisions = repository.get_revisions(history)
2040
2043
    for i, rev in enumerate(revisions):
2041
2044
        lr = LogRevision(rev, i + last_revno, 0, None)