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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py

Issue 2715093002: Add back use of --auth-refresh-token-json for wpt-import (Closed)
Patch Set: Update test Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """An interface to git-cl. 5 """An interface to git-cl.
6 6
7 The git-cl tool is responsible for communicating with Rietveld, Gerrit, 7 The git-cl tool is responsible for communicating with Rietveld, Gerrit,
8 and Buildbucket to manage changelists and try jobs associated with them. 8 and Buildbucket to manage changelists and try jobs associated with them.
9 """ 9 """
10 10
11 import json 11 import json
12 import logging 12 import logging
13 import re 13 import re
14 14
15 from webkitpy.common.net.buildbot import Build, filter_latest_builds 15 from webkitpy.common.net.buildbot import Build, filter_latest_builds
16 16
17 _log = logging.getLogger(__name__) 17 _log = logging.getLogger(__name__)
18 18
19 # A refresh token may be needed for some commands, such as git cl try,
20 # in order to authenticate with buildbucket.
21 _COMMANDS_THAT_TAKE_REFRESH_TOKEN = ('try',)
22
19 23
20 class GitCL(object): 24 class GitCL(object):
21 25
22 def __init__(self, host, cwd=None): 26 def __init__(self, host, auth_refresh_token_json=None, cwd=None):
23 self._host = host 27 self._host = host
28 self._auth_refresh_token_json = auth_refresh_token_json
24 self._cwd = cwd 29 self._cwd = cwd
25 30
26 def run(self, args): 31 def run(self, args):
27 """Runs git-cl with the given arguments and returns the output.""" 32 """Runs git-cl with the given arguments and returns the output."""
28 command = ['git', 'cl'] + args 33 command = ['git', 'cl'] + args
34 if self._auth_refresh_token_json and args[0] in _COMMANDS_THAT_TAKE_REFR ESH_TOKEN:
35 command += ['--auth-refresh-token-json', self._auth_refresh_token_js on]
29 return self._host.executive.run_command(command, cwd=self._cwd) 36 return self._host.executive.run_command(command, cwd=self._cwd)
30 37
31 def get_issue_number(self): 38 def get_issue_number(self):
32 return self.run(['issue']).split()[2] 39 return self.run(['issue']).split()[2]
33 40
34 def wait_for_try_jobs(self, poll_delay_seconds=10 * 60, timeout_seconds=120 * 60): 41 def wait_for_try_jobs(self, poll_delay_seconds=10 * 60, timeout_seconds=120 * 60):
35 """Waits until all try jobs are finished. 42 """Waits until all try jobs are finished.
36 43
37 Args: 44 Args:
38 poll_delay_seconds: Time to wait between fetching results. 45 poll_delay_seconds: Time to wait between fetching results.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 assert build_number and build_number.isdigit() 91 assert build_number and build_number.isdigit()
85 return Build(builder_name, int(build_number)) 92 return Build(builder_name, int(build_number))
86 93
87 @staticmethod 94 @staticmethod
88 def all_jobs_finished(try_results): 95 def all_jobs_finished(try_results):
89 return all(r.get('status') == 'COMPLETED' for r in try_results) 96 return all(r.get('status') == 'COMPLETED' for r in try_results)
90 97
91 @staticmethod 98 @staticmethod
92 def has_failing_try_results(try_results): 99 def has_failing_try_results(try_results):
93 return any(r.get('result') == 'FAILURE' for r in try_results) 100 return any(r.get('result') == 'FAILURE' for r in try_results)
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698