remote-bzr: improve author sanitazion
So that we don't end up with '<None>', and also synchronize it with the one from remote-hg. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
c95c35f4b8
commit
3f6e7c0af1
@ -38,6 +38,7 @@ import atexit, shutil, hashlib, urlparse, subprocess
|
|||||||
|
|
||||||
NAME_RE = re.compile('^([^<>]+)')
|
NAME_RE = re.compile('^([^<>]+)')
|
||||||
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
|
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
|
||||||
|
EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ \\t<>]*?)\\b([^ \\t<>]+@[^ \\t<>]+)')
|
||||||
RAW_AUTHOR_RE = re.compile('^(\w+) (.+)? <(.*)> (\d+) ([+-]\d+)')
|
RAW_AUTHOR_RE = re.compile('^(\w+) (.+)? <(.*)> (\d+) ([+-]\d+)')
|
||||||
|
|
||||||
def die(msg, *args):
|
def die(msg, *args):
|
||||||
@ -175,9 +176,19 @@ def fixup_user(user):
|
|||||||
name = m.group(1)
|
name = m.group(1)
|
||||||
mail = m.group(2).strip()
|
mail = m.group(2).strip()
|
||||||
else:
|
else:
|
||||||
m = NAME_RE.match(user)
|
m = EMAIL_RE.match(user)
|
||||||
if m:
|
if m:
|
||||||
name = m.group(1).strip()
|
name = m.group(1)
|
||||||
|
mail = m.group(2)
|
||||||
|
else:
|
||||||
|
m = NAME_RE.match(user)
|
||||||
|
if m:
|
||||||
|
name = m.group(1).strip()
|
||||||
|
|
||||||
|
if not name:
|
||||||
|
name = 'unknown'
|
||||||
|
if not mail:
|
||||||
|
mail = 'Unknown'
|
||||||
|
|
||||||
return '%s <%s>' % (name, mail)
|
return '%s <%s>' % (name, mail)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user