Show More
@@ -202,9 +202,9 b' def parsemailmap(mailmapcontent):' | |||||
202 | if line.lstrip().startswith('#') or any(c not in line for c in '<>@'): |
|
202 | if line.lstrip().startswith('#') or any(c not in line for c in '<>@'): | |
203 | continue |
|
203 | continue | |
204 |
|
204 | |||
205 | # name, email hold the parsed emails and names for each line |
|
205 | # names, emails hold the parsed emails and names for each line | |
206 | # name_builder holds the words in a persons name |
|
206 | # name_builder holds the words in a persons name | |
207 | name, email = [], [] |
|
207 | names, emails = [], [] | |
208 | namebuilder = [] |
|
208 | namebuilder = [] | |
209 |
|
209 | |||
210 | for element in line.split(): |
|
210 | for element in line.split(): | |
@@ -215,15 +215,15 b' def parsemailmap(mailmapcontent):' | |||||
215 | elif element.startswith('<') and element.endswith('>'): |
|
215 | elif element.startswith('<') and element.endswith('>'): | |
216 | # We have found an email. |
|
216 | # We have found an email. | |
217 | # Parse it, and finalize any names from earlier |
|
217 | # Parse it, and finalize any names from earlier | |
218 | email.append(element[1:-1]) # Slice off the "<>" |
|
218 | emails.append(element[1:-1]) # Slice off the "<>" | |
219 |
|
219 | |||
220 | if namebuilder: |
|
220 | if namebuilder: | |
221 | name.append(' '.join(namebuilder)) |
|
221 | names.append(' '.join(namebuilder)) | |
222 | namebuilder = [] |
|
222 | namebuilder = [] | |
223 |
|
223 | |||
224 | # Break if we have found a second email, any other |
|
224 | # Break if we have found a second email, any other | |
225 | # data does not fit the spec for .mailmap |
|
225 | # data does not fit the spec for .mailmap | |
226 | if len(email) > 1: |
|
226 | if len(emails) > 1: | |
227 | break |
|
227 | break | |
228 |
|
228 | |||
229 | else: |
|
229 | else: | |
@@ -231,13 +231,13 b' def parsemailmap(mailmapcontent):' | |||||
231 | namebuilder.append(element) |
|
231 | namebuilder.append(element) | |
232 |
|
232 | |||
233 | mailmapkey = mailmapping( |
|
233 | mailmapkey = mailmapping( | |
234 | email=email[-1], |
|
234 | email=emails[-1], | |
235 | name=name[-1] if len(name) == 2 else None, |
|
235 | name=names[-1] if len(names) == 2 else None, | |
236 | ) |
|
236 | ) | |
237 |
|
237 | |||
238 | mailmap[mailmapkey] = mailmapping( |
|
238 | mailmap[mailmapkey] = mailmapping( | |
239 | email=email[0], |
|
239 | email=emails[0], | |
240 | name=name[0] if name else None, |
|
240 | name=names[0] if names else None, | |
241 | ) |
|
241 | ) | |
242 |
|
242 | |||
243 | return mailmap |
|
243 | return mailmap |
General Comments 0
You need to be logged in to leave comments.
Login now