changeset 26556:2bef84fad19f

extract: remove the 'user' variable It is not heavily used enough to justify being something other than a dictionary entry.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 06 Oct 2015 02:16:24 -0700
parents 1e33384ff2ed
children 23f3f1cbd53b
files mercurial/patch.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Oct 06 02:11:09 2015 -0700
+++ b/mercurial/patch.py	Tue Oct 06 02:16:24 2015 -0700
@@ -182,8 +182,8 @@
         msg = email.Parser.Parser().parse(fileobj)
 
         subject = msg['Subject']
-        user = msg['From']
-        if not subject and not user:
+        data['user'] = msg['From']
+        if not subject and not data['user']:
             # Not an email, restore parsed headers if any
             subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n'
 
@@ -197,8 +197,8 @@
                     subject = subject[pend + 1:].lstrip()
             subject = re.sub(r'\n[ \t]+', ' ', subject)
             ui.debug('Subject: %s\n' % subject)
-        if user:
-            ui.debug('From: %s\n' % user)
+        if data['user']:
+            ui.debug('From: %s\n' % data['user'])
         diffs_seen = 0
         ok_types = ('text/plain', 'text/x-diff', 'text/x-patch')
         message = ''
@@ -228,8 +228,8 @@
                         subject = None
                     elif hgpatchheader:
                         if line.startswith('# User '):
-                            user = line[7:]
-                            ui.debug('From: %s\n' % user)
+                            data['user'] = line[7:]
+                            ui.debug('From: %s\n' % data['user'])
                         elif line.startswith("# Date "):
                             data['date'] = line[7:]
                         elif line.startswith("# Branch "):
@@ -260,7 +260,6 @@
     if subject and not message.startswith(subject):
         message = '%s\n%s' % (subject, message)
     data['message'] = message
-    data['user'] = user
     tmpfp.close()
     if parents:
         data['p1'] = parents.pop(0)