use regexp to parse the mailmap
this also makes parse_mailmap() work with the swift .mailmap and should be more readable Change-Id: I3abb2a18d655e507bee5f621ebc64421d943cf0b
This commit is contained in:
parent
f45c20e0ed
commit
1773f0b17a
11
setup.py
11
setup.py
|
@ -34,11 +34,12 @@ def parse_mailmap(mailmap='.mailmap'):
|
|||
if os.path.exists(mailmap):
|
||||
with open(mailmap, 'r') as fp:
|
||||
for l in fp:
|
||||
l = l.strip()
|
||||
if not l.startswith('#') and ' ' in l:
|
||||
canonical_email, alias = [x for x in l.split(' ')
|
||||
if x.startswith('<')]
|
||||
mapping[alias] = canonical_email
|
||||
try:
|
||||
canonical_email, alias = re.match(
|
||||
r'[^#]*?(<.+>).*(<.+>).*', l).groups()
|
||||
except AttributeError:
|
||||
continue
|
||||
mapping[alias] = canonical_email
|
||||
return mapping
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue