Bug 1257797 - Fix bug that prevents continuing wpt update correctly after patch fails to apply, r=Ms2ger
authorJames Graham <james@hoppipolla.co.uk>
Wed, 16 Mar 2016 14:03:01 +0000
changeset 289291 2b403e072b392321765dc94f66d239a3bab5e585
parent 289290 39ab55ac2fc8017c986dcf8629129379f2e9351b
child 289292 95f97693b04f1d244ef459d248ac862afd8e8536
push id73789
push userjames@hoppipolla.co.uk
push dateFri, 18 Mar 2016 11:39:56 +0000
treeherdermozilla-inbound@95f97693b04f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs1257797
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1257797 - Fix bug that prevents continuing wpt update correctly after patch fails to apply, r=Ms2ger MozReview-Commit-ID: 16VZ2n6Kulq
testing/web-platform/update/upstream.py
--- a/testing/web-platform/update/upstream.py
+++ b/testing/web-platform/update/upstream.py
@@ -193,17 +193,18 @@ class SelectCommits(Step):
                 break
 
 class MovePatches(Step):
     """Convert gecko commits into patches against upstream and commit these to the sync tree."""
 
     provides = ["commits_loaded"]
 
     def create(self, state):
-        state.commits_loaded = 0
+        if not hasattr(state, "commits_loaded"):
+            state.commits_loaded = 0
 
         strip_path = os.path.relpath(state.tests_path,
                                      state.local_tree.root)
         self.logger.debug("Stripping patch %s" % strip_path)
 
         if not hasattr(state, "patch"):
             state.patch = None
 
@@ -213,16 +214,18 @@ class MovePatches(Step):
             if not state.patch:
                 patch = commit.export_patch(state.tests_path)
                 stripped_patch = rewrite_patch(patch, strip_path)
             else:
                 filename, stripped_patch = state.patch
                 with open(filename) as f:
                     stripped_patch.diff = f.read()
                 state.patch = None
+            if not stripped_patch.diff:
+                continue
             try:
                 state.sync_tree.import_patch(stripped_patch)
             except:
                 with tempfile.NamedTemporaryFile(delete=False, suffix=".diff") as f:
                     f.write(stripped_patch.diff)
                     print """Patch failed to apply. Diff saved in %s.
 Fix this file so it applies and run with --continue""" % f.name
                     state.patch = (f.name, stripped_patch)