[PATCH] D30594: Make llvm-git (monorepo helper) compatible with both Python 2 and 3

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 15:20:32 PST 2017


t.p.northover updated this revision to Diff 90950.
t.p.northover added a comment.

Thanks for the suggestions. I think I've incorporated all of them, and the diff seems much cleaner.


Repository:
  rL LLVM

https://reviews.llvm.org/D30594

Files:
  llvm/utils/git-svn/git-llvm


Index: llvm/utils/git-svn/git-llvm
===================================================================
--- llvm/utils/git-svn/git-llvm
+++ llvm/utils/git-svn/git-llvm
@@ -93,6 +93,9 @@
 
     log_verbose('Command took %0.1fs' % elapsed)
 
+    stdout = stdout.decode('utf-8')
+    stderr = stderr.decode('utf-8')
+
     if p.returncode == 0:
         if stderr:
             eprint('`%s` printed to stderr:' % ' '.join(cmd))
@@ -191,8 +194,8 @@
         # git is the only thing that can handle its own patches...
         log_verbose('Apply patch: %s' % diff)
         try:
-            shell(['git', 'apply', '-p2', '-'], cwd=svn_sr_path, stdin=diff,
-                  die_on_failure=False)
+            shell(['git', 'apply', '-p2', '-'], cwd=svn_sr_path,
+                   stdin=diff.encode('utf-8'), die_on_failure=False)
         except RuntimeError as e:
             eprint("Patch doesn't apply: maybe you should try `git pull -r` "
                    "first?")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30594.90950.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170307/e9efae83/attachment.bin>


More information about the llvm-commits mailing list