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 cec54e988c9e1a70b2aba4256af3a5a8af89c529..a1a34d9e83d4df736aba24096b1805f9f8d826bf 100644 |
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py |
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py |
@@ -30,6 +30,7 @@ class LocalWPT(object): |
""" |
self.host = host |
self.path = path |
+ self.branch_name = 'chromium-export-try' |
if no_fetch: |
_log.info('Skipping remote WPT fetch') |
@@ -68,6 +69,10 @@ class LocalWPT(object): |
self.run(['git', 'reset', '--hard', 'HEAD']) |
self.run(['git', 'clean', '-fdx']) |
self.run(['git', 'checkout', 'origin/master']) |
+ try: |
+ self.run(['git', 'branch', '-D', self.branch_name]) |
+ except ScriptError: |
+ pass |
qyearsley
2017/01/06 19:20:24
What kind of circumstance would result in a Script
jeffcarp
2017/01/06 23:51:59
If the branch doesn't exist, it throws a ScriptErr
|
def all_branches(self): |
"""Returns a list of local and remote branches.""" |
@@ -82,20 +87,20 @@ class LocalWPT(object): |
""" |
self.clean() |
all_branches = self.all_branches() |
- branch_name = 'chromium-export-try' |
- remote_branch_name = 'remotes/github/%s' % branch_name |
+ remote_branch_name = 'remotes/github/%s' % self.branch_name |
qyearsley
2017/01/06 19:20:24
Where is the remote name "github" determined?
jeffcarp
2017/01/06 23:51:59
Right now it's set manually when I add it to the l
|
- if branch_name in all_branches: |
- _log.info('Local branch %s already exists, deleting', branch_name) |
- self.run(['git', 'branch', '-D', branch_name]) |
+ if self.branch_name in all_branches: |
+ _log.info('Local branch %s already exists, deleting', self.branch_name) |
+ self.run(['git', 'branch', '-D', self.branch_name]) |
+ # TODO(jeffcarp): this is broken |
qyearsley
2017/01/06 19:20:24
Should be more specific: What's broken, how, and w
jeffcarp
2017/01/07 00:08:48
Removing this functionality. Since we're deleting
|
if remote_branch_name in all_branches: |
- _log.info('Remote branch %s already exists, deleting', branch_name) |
+ _log.info('Remote branch %s already exists, deleting', self.branch_name) |
# TODO(jeffcarp): Investigate what happens when remote branch exists. |
- self.run(['git', 'push', 'github', ':{}'.format(branch_name)]) |
+ self.run(['git', 'push', 'github', ':{}'.format(self.branch_name)]) |
- _log.info('Creating local branch %s', branch_name) |
- self.run(['git', 'checkout', '-b', branch_name]) |
+ _log.info('Creating local branch %s', self.branch_name) |
+ self.run(['git', 'checkout', '-b', self.branch_name]) |
# Remove Chromium WPT directory prefix. |
patch = patch.replace(CHROMIUM_WPT_DIR, '') |
@@ -104,9 +109,9 @@ class LocalWPT(object): |
# or something not off-by-one. |
self.run(['git', 'apply', '-'], input=patch) |
self.run(['git', 'commit', '-am', message]) |
- self.run(['git', 'push', 'github', branch_name]) |
+ self.run(['git', 'push', 'github', self.branch_name]) |
- return branch_name |
+ return self.branch_name |
def test_patch(self, patch): |
"""Returns the expected output of a patch against origin/master. |
@@ -127,7 +132,7 @@ class LocalWPT(object): |
self.run(['git', 'add', '.']) |
output = self.run(['git', 'diff', 'origin/master']) |
except ScriptError as error: |
- _log.error('Error while applying patch: %s', error) |
+ _log.info('Patch did not apply cleanly, skipping...') |
qyearsley
2017/01/06 19:20:24
This could also be "warning" rather than "info".
|
output = '' |
self.clean() |