Bug 1257797 - Fix bug that prevents continuing wpt update correctly after patch fails to apply, r=Ms2ger
MozReview-Commit-ID: 16VZ2n6Kulq
--- 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)