Index: third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py |
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py |
index 34b80cdd68a7feea11e99308ab8316b3c67ade3e..1c7ac2579d366ba7ba3cfe8931b6fda8ddde2f62 100644 |
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py |
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl.py |
@@ -16,16 +16,23 @@ from webkitpy.common.net.buildbot import Build, filter_latest_builds |
_log = logging.getLogger(__name__) |
+# A refresh token may be needed for some commands, such as git cl try, |
+# in order to authenticate with buildbucket. |
+_COMMANDS_THAT_TAKE_REFRESH_TOKEN = ('try',) |
+ |
class GitCL(object): |
- def __init__(self, host, cwd=None): |
+ def __init__(self, host, auth_refresh_token_json=None, cwd=None): |
self._host = host |
+ self._auth_refresh_token_json = auth_refresh_token_json |
self._cwd = cwd |
def run(self, args): |
"""Runs git-cl with the given arguments and returns the output.""" |
command = ['git', 'cl'] + args |
+ if self._auth_refresh_token_json and args[0] in _COMMANDS_THAT_TAKE_REFRESH_TOKEN: |
+ command += ['--auth-refresh-token-json', self._auth_refresh_token_json] |
return self._host.executive.run_command(command, cwd=self._cwd) |
def get_issue_number(self): |