[U-Boot] [PATCH v2 02/10] patman: Adjust handling of unicode email address

Simon Glass sjg at chromium.org
Mon May 29 21:31:23 UTC 2017


Don't mess with the email address when outputting them. Just make sure
they are encoded with utf-8.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Expand the patch to cover all cases
- Drop RFC tag
- Rewrite commit message

 tools/patman/gitutil.py |  2 ++
 tools/patman/series.py  | 10 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 0d23079a3a..167bda38fc 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -407,6 +407,8 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
         cc = []
     cmd = ['git', 'send-email', '--annotate']
     if in_reply_to:
+        if type(in_reply_to) != str:
+            in_reply_to = in_reply_to.encode('utf-8')
         cmd.append('--in-reply-to="%s"' % in_reply_to)
     if thread:
         cmd.append('--thread')
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 134a381ae3..7a3534fee9 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -119,7 +119,7 @@ class Series(dict):
                     email = col.Color(col.YELLOW, "<alias '%s' not found>"
                             % tag)
                 if email:
-                    print('      Cc: ', email.encode('utf-8'))
+                    print('      Cc: ', email)
         print
         for item in to_set:
             print('To:\t ', item)
@@ -229,13 +229,17 @@ class Series(dict):
                                            raise_on_error=raise_on_error)
             if add_maintainers:
                 list += get_maintainer.GetMaintainer(commit.patch)
+            list = [m.encode('utf-8') if type(m) != str else m for m in list]
             all_ccs += list
-            print(commit.patch, ', '.join(set(list)).encode('utf-8'), file=fd)
+            print(commit.patch, ', '.join(set(list)), file=fd)
             self._generated_cc[commit.patch] = list
 
         if cover_fname:
             cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
-            cc_list = ', '.join([x.decode('utf-8') for x in set(cover_cc + all_ccs)])
+            cover_cc = [m.encode('utf-8') if type(m) != str else m
+                        for m in cover_cc]
+            cc_list = ', '.join([x.decode('utf-8')
+                                 for x in set(cover_cc + all_ccs)])
             print(cover_fname, cc_list.encode('utf-8'), file=fd)
 
         fd.close()
-- 
2.13.0.219.gdb65acc882-goog



More information about the U-Boot mailing list