]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/combo-layer: skip empty commits
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Mon, 7 Nov 2011 12:07:02 +0000 (12:07 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 7 Nov 2011 13:58:39 +0000 (13:58 +0000)
If a commit is empty (for example, commits brought over from svn where
only properties were changed) then attempting to apply it with "git am"
will result in the error "Patch format detection failed", so skip it
instead.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
scripts/combo-layer

index 597d6cb835f20ddefe08772da2aba6b80a4de03d..b4b1e4891e3787e1df43810f07aa744329287ce6 100755 (executable)
@@ -252,18 +252,21 @@ def action_apply_patch(conf, args):
         for line in open(repo['patchlist']):
             patchfile = line.split()[0]
             lastrev = line.split()[1]
-            cmd = "git am --keep-cr -s -p1 %s" % patchfile
-            logger.info("Apply %s" % patchfile )
-            try:
-                runcmd(cmd)
-            except subprocess.CalledProcessError:
-                logger.info('running "git am --abort" to cleanup repo')
-                runcmd("git am --abort")
-                logger.error('"%s" failed' % cmd)
-                logger.info("please manually apply patch %s" % patchfile)
-                logger.info("After applying, run this tool again to apply the remaining patches")
-                conf.update(name, "last_revision", lastrev)
-                sys.exit(0)
+            if os.path.getsize(patchfile) == 0:
+                logger.info("(skipping %s - no changes)", lastrev)
+            else:
+                cmd = "git am --keep-cr -s -p1 %s" % patchfile
+                logger.info("Apply %s" % patchfile )
+                try:
+                    runcmd(cmd)
+                except subprocess.CalledProcessError:
+                    logger.info('running "git am --abort" to cleanup repo')
+                    runcmd("git am --abort")
+                    logger.error('"%s" failed' % cmd)
+                    logger.info("please manually apply patch %s" % patchfile)
+                    logger.info("After applying, run this tool again to apply the remaining patches")
+                    conf.update(name, "last_revision", lastrev)
+                    sys.exit(0)
         conf.update(name, "last_revision", lastrev)
 
 def action_splitpatch(conf, args):