Bug 1331899 - Fix rename handling in wpt sync process, r=Ms2ger
authorJames Graham <james@hoppipolla.co.uk>
Tue, 03 Jan 2017 19:06:50 +0000
changeset 330067 78932f311341b35b265c21dbf7c8c37066fc0fc1
parent 330066 496a7780461a7bcf3ebdd7675d9ba9198b25c531
child 330068 beb43155b7a647b841f051f9cb7ae65550634912
push id85890
push userjames@hoppipolla.co.uk
push dateThu, 19 Jan 2017 14:28:37 +0000
treeherdermozilla-inbound@cf7aaeb55da0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs1331899
milestone53.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 1331899 - Fix rename handling in wpt sync process, r=Ms2ger MozReview-Commit-ID: JbBaYGnYKKY
testing/web-platform/update/upstream.py
--- a/testing/web-platform/update/upstream.py
+++ b/testing/web-platform/update/upstream.py
@@ -21,21 +21,22 @@ def rewrite_patch(patch, strip_dir):
     :param patch: the Patch to convert
     :param strip_dir: the path prefix to remove
     """
 
     if not strip_dir.startswith("/"):
         strip_dir = "/%s"% strip_dir
 
     new_diff = []
-    line_starts = ["diff ", "+++ ", "--- ", "rename from ", "rename to "]
+    line_starts = [("diff ", True), ("+++ ", True), ("--- ", True), ("rename from ", False), ("rename to ", False)]
     for line in patch.diff.split("\n"):
-        for start in line_starts:
+        for start, leading_slash in line_starts:
+            strip = strip_dir if leading_slash else strip_dir[1:]
             if line.startswith(start):
-                new_diff.append(line.replace(strip_dir, "").encode("utf8"))
+                new_diff.append(line.replace(strip, "").encode("utf8"))
                 break
         else:
             new_diff.append(line)
 
     new_diff = "\n".join(new_diff)
 
     assert new_diff != patch