~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Lukáš Lalinský
  • Date: 2007-12-02 18:59:28 UTC
  • mto: This revision was merged to the branch mainline in revision 3080.
  • Revision ID: lalinsky@gmail.com-20071202185928-00cgoqzowl3s87hi
Move the name and e-mail address extraction logic to config.parse_username.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
import re
54
54
 
55
55
from bzrlib import (
 
56
    config,
56
57
    lazy_regex,
57
58
    registry,
58
59
    symbol_versioning,
603
604
    def show(self, revno, rev, delta):
604
605
        raise NotImplementedError('not implemented in abstract base')
605
606
 
606
 
    _short_name_re = lazy_regex.lazy_compile(r'(.*?)\s*<(.*@.*)>')
607
 
 
608
607
    def short_committer(self, rev):
609
 
        name = rev.committer
610
 
        match = self._short_name_re.match(name)
611
 
        if match is None:
 
608
        name, address = config.parse_username(rev.committer)
 
609
        if name:
612
610
            return name
613
 
        else:
614
 
            return match.group(1) or match.group(2)
 
611
        return address
615
612
 
616
613
    def short_author(self, rev):
617
 
        name = rev.get_apparent_author()
618
 
        match = self._short_name_re.match(name)
619
 
        if match is None:
 
614
        name, address = config.parse_username(rev.get_apparent_author())
 
615
        if name:
620
616
            return name
621
 
        else:
622
 
            return match.group(1) or match.group(2)
 
617
        return address
623
618
 
624
619
 
625
620
class LongLogFormatter(LogFormatter):