Patchwork D3002: stringutil: rename local email/names variables to their plural forms

login
register
mail settings
Submitter phabricator
Date March 31, 2018, 8:37 p.m.
Message ID <differential-rev-PHID-DREV-x4qxlnmx3n642tg5rmkg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30076/
State Superseded
Headers show

Comments

phabricator - March 31, 2018, 8:37 p.m.
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

Patch

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