Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py |
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py |
index d7217c0999415007a3f5e9ea49322a3559e2f160..c0e17d4f7d1514a60052283f6a611eee0f65c892 100644 |
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py |
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py |
@@ -6,6 +6,7 @@ |
import logging |
+from webkitpy.common.system.executive import ScriptError |
from webkitpy.w3c.chromium_commit import ChromiumCommit |
WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-tests.git' |
@@ -107,6 +108,32 @@ class LocalWPT(object): |
return branch_name |
+ def test_patch(self, patch): |
+ """Returns the expected output of a patch agains origin/master. |
qyearsley
2016/12/22 22:04:54
Nit: agains -> against
|
+ |
+ Args: |
+ patch: The patch to test against. |
+ |
+ Returns: |
+ A string containing the diff the patch produced. |
qyearsley
2016/12/22 22:04:54
Sometimes I'm confused about the words "diff" and
jeffcarp
2016/12/22 23:14:29
Hm what do you suggest re: diff/patch?
That sound
qyearsley
2016/12/22 23:19:53
I was wondering if you could put an example (very
|
+ """ |
+ self.clean() |
+ |
+ # Remove Chromium WPT directory prefix. |
+ # TODO(jeffcarp): dedupe |
qyearsley
2016/12/22 22:04:54
Dedupe what?
jeffcarp
2016/12/22 23:14:29
Oops it was already deduped.
|
+ patch = patch.replace(CHROMIUM_WPT_DIR, '') |
+ |
+ try: |
+ self.run(['git', 'apply', '-'], input=patch) |
+ self.run(['git', 'add', '.']) |
+ output = self.run(['git', 'diff', 'origin/master']) |
+ except ScriptError as error: |
+ _log.error('Error while applying patch: %s', error) |
+ output = '' |
+ |
+ self.clean() |
+ return output |
+ |
def commits_behind_master(self, commit): |
"""Returns the number of commits after the given commit on origin/master. |