/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 bzrlib/log.py

  • Committer: Matt Giuca
  • Date: 2011-03-21 11:26:50 UTC
  • mto: This revision was merged to the branch mainline in revision 5767.
  • Revision ID: matt.giuca@gmail.com-20110321112650-7c9r90ir7cg9fhes
log: If a revision is not in the branch, it now sets its revno to None
    (instead of setting it to its rev-id).
    Updated LogRevision and ShortLogFormatter to handle a revno of None.
test_log: Updated expected output for TestRevisionNotInBranch (no longer
    expects rev-ids to be shown).

Show diffs side-by-side

added added

removed removed

Lines of Context:
629
629
def _compute_revno_str(branch, rev_id):
630
630
    """Compute the revno string from a rev_id.
631
631
 
632
 
    :return: The revno string, falling back to the rev_id string itself if the
633
 
        revision is not in the supplied branch.
 
632
    :return: The revno string, or None if the revision is not in the supplied
 
633
        branch.
634
634
    """
635
635
    try:
636
636
        revno = branch.revision_id_to_dotted_revno(rev_id)
637
637
    except errors.NoSuchRevision:
638
 
        # The revision must be outside of this branch; just use the rev id
639
 
        # in place of the revno.
640
 
        return rev_id
 
638
        # The revision must be outside of this branch
 
639
        return None
641
640
    else:
642
641
        return '.'.join(str(n) for n in revno)
643
642
 
1318
1317
    def __init__(self, rev=None, revno=None, merge_depth=0, delta=None,
1319
1318
                 tags=None, diff=None):
1320
1319
        self.rev = rev
1321
 
        self.revno = str(revno)
 
1320
        self.revno = None if revno is None else str(revno)
1322
1321
        self.merge_depth = merge_depth
1323
1322
        self.delta = delta
1324
1323
        self.tags = tags
1645
1644
        indent = '    ' * depth
1646
1645
        revno_width = self.revno_width_by_depth.get(depth)
1647
1646
        if revno_width is None:
1648
 
            if revision.revno.find('.') == -1:
 
1647
            if revision.revno is None or revision.revno.find('.') == -1:
1649
1648
                # mainline revno, e.g. 12345
1650
1649
                revno_width = 5
1651
1650
            else:
1659
1658
        if revision.tags:
1660
1659
            tags = ' {%s}' % (', '.join(revision.tags))
1661
1660
        to_file.write(indent + "%*s %s\t%s%s%s\n" % (revno_width,
1662
 
                revision.revno, self.short_author(revision.rev),
 
1661
                revision.revno or "", self.short_author(revision.rev),
1663
1662
                format_date(revision.rev.timestamp,
1664
1663
                            revision.rev.timezone or 0,
1665
1664
                            self.show_timezone, date_fmt="%Y-%m-%d",