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