Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt.py

Issue 2608923002: [WPT Export] Delete remote branch, add label, additional refactoring (Closed)
Patch Set: Address CL feedback Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c165c905017f70c5da997e70c35bc3e31c0fbf27 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,8 @@ class LocalWPT(object):
self.run(['git', 'reset', '--hard', 'HEAD'])
self.run(['git', 'clean', '-fdx'])
self.run(['git', 'checkout', 'origin/master'])
+ if self.branch_name in self.all_branches():
+ self.run(['git', 'branch', '-D', self.branch_name])
def all_branches(self):
"""Returns a list of local and remote branches."""
@@ -82,20 +85,13 @@ class LocalWPT(object):
"""
self.clean()
all_branches = self.all_branches()
- branch_name = 'chromium-export-try'
- remote_branch_name = 'remotes/github/%s' % branch_name
- 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])
- if remote_branch_name in all_branches:
- _log.info('Remote branch %s already exists, deleting', branch_name)
- # TODO(jeffcarp): Investigate what happens when remote branch exists.
- self.run(['git', 'push', 'github', ':{}'.format(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 +100,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 +123,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.warning('Patch did not apply cleanly, skipping...')
output = ''
self.clean()
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/local_wpt_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698