From patchwork Sat Mar 31 20:37:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D3002: stringutil: rename local email/names variables to their plural forms From: phabricator X-Patchwork-Id: 30076 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sat, 31 Mar 2018 20:37:55 +0000 sheehan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY email and name variables are renamed to emails and names (respectively). This is because the email variable name shadows the email function within the stringutil module. Since we are renaming email, we also rename name for consistency. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3002 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS To: sheehan, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -204,7 +204,7 @@ # name, email hold the parsed emails and names for each line # name_builder holds the words in a persons name - name, email = [], [] + names, emails = [], [] namebuilder = [] for element in line.split(): @@ -215,29 +215,29 @@ elif element.startswith('<') and element.endswith('>'): # We have found an email. # Parse it, and finalize any names from earlier - email.append(element[1:-1]) # Slice off the "<>" + emails.append(element[1:-1]) # Slice off the "<>" if namebuilder: - name.append(' '.join(namebuilder)) + names.append(' '.join(namebuilder)) namebuilder = [] # Break if we have found a second email, any other # data does not fit the spec for .mailmap - if len(email) > 1: + if len(emails) > 1: break else: # We have found another word in the committers name namebuilder.append(element) mailmapkey = mailmapping( - email=email[-1], - name=name[-1] if len(name) == 2 else None, + email=emails[-1], + name=names[-1] if len(names) == 2 else None, ) mailmap[mailmapkey] = mailmapping( - email=email[0], - name=name[0] if name else None, + email=emails[0], + name=names[0] if names else None, ) return mailmap