patman: Deal with 'git apply' failures correctly
authorSimon Glass <sjg@chromium.org>
Sun, 20 Apr 2014 16:50:13 +0000 (10:50 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 9 May 2014 20:50:39 +0000 (14:50 -0600)
This sort of failure is rare, but the code to deal with it is wrong.
Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/patman/gitutil.py

index 5dcbaa3bd79effdf2bff3ba497a360378106f5a0..3ea256de2e262cd0e34de4d9126fe95ee10e843c 100644 (file)
@@ -11,6 +11,7 @@ import subprocess
 import sys
 import terminal
 
+import checkpatch
 import settings
 
 
@@ -193,6 +194,7 @@ def ApplyPatch(verbose, fname):
     Args:
         fname: filename of patch file to apply
     """
+    col = terminal.Color()
     cmd = ['git', 'am', fname]
     pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
             stderr=subprocess.PIPE)
@@ -203,8 +205,8 @@ def ApplyPatch(verbose, fname):
             print line
         match = re_error.match(line)
         if match:
-            print GetWarningMsg('warning', match.group(1), int(match.group(2)),
-                    'Patch failed')
+            print checkpatch.GetWarningMsg(col, 'warning', match.group(1),
+                                           int(match.group(2)), 'Patch failed')
     return pipe.returncode == 0, stdout
 
 def ApplyPatches(verbose, args, start_point):