mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
[git_auth] Move config wizard to creds-check
Bug: b/404613530 Change-Id: Ie0b8fd675b66739a129d5eeeda895473a8a49eeb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6368999 Commit-Queue: Allen Li <ayatane@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
11
git_auth.py
11
git_auth.py
@@ -375,17 +375,6 @@ class ConfigWizard(object):
|
|||||||
self._println(
|
self._println(
|
||||||
'(Report any issues to https://issues.chromium.org/issues/new?component=1456702&template=2076315)'
|
'(Report any issues to https://issues.chromium.org/issues/new?component=1456702&template=2076315)'
|
||||||
)
|
)
|
||||||
if not newauth.Enabled():
|
|
||||||
self._println()
|
|
||||||
self._println('You have not enabled new auth.')
|
|
||||||
self._println('This tool will configure Git to use new auth,')
|
|
||||||
self._println('while depot_tools will continue to use old auth.')
|
|
||||||
self._println(
|
|
||||||
"We recommend not continuing, though you may if you're adventurous."
|
|
||||||
)
|
|
||||||
self._println('(It will probably work. Maybe.)')
|
|
||||||
if not self._ui.read_yn('Continue?', default=False):
|
|
||||||
return
|
|
||||||
self._println()
|
self._println()
|
||||||
self._fix_gitcookies()
|
self._fix_gitcookies()
|
||||||
self._println()
|
self._println()
|
||||||
|
|||||||
44
git_cl.py
44
git_cl.py
@@ -3904,27 +3904,13 @@ def CMDcreds_check(parser, args):
|
|||||||
|
|
||||||
if newauth.Enabled():
|
if newauth.Enabled():
|
||||||
cl = Changelist()
|
cl = Changelist()
|
||||||
host = cl.GetGerritHost()
|
try:
|
||||||
print(f'Using Gerrit host: {host!r}')
|
remote_url = cl.GetRemoteUrl()
|
||||||
git_auth.Configure(os.getcwd(), cl)
|
except subprocess2.CalledProcessError:
|
||||||
# Perform some advisory checks
|
remote_url = ''
|
||||||
email = scm.GIT.GetConfig(os.getcwd(), 'user.email') or ''
|
wizard = git_auth.ConfigWizard(
|
||||||
print(f'Using email (configured in Git): {email!r}')
|
git_auth.UserInterface(sys.stdin, sys.stdout))
|
||||||
if gerrit_util.ShouldUseSSO(host, email):
|
wizard.run(remote_url)
|
||||||
print('Detected that we should be using SSO.')
|
|
||||||
else:
|
|
||||||
print('Detected that we should be using git-credential-luci.')
|
|
||||||
a = gerrit_util.GitCredsAuthenticator()
|
|
||||||
try:
|
|
||||||
a.luci_auth.get_access_token()
|
|
||||||
except auth.GitLoginRequiredError as e:
|
|
||||||
print('NOTE: You are not logged in with git-credential-luci.')
|
|
||||||
print(
|
|
||||||
'You will not be able to perform many actions without logging in.'
|
|
||||||
)
|
|
||||||
print('If you wish to log in, run:')
|
|
||||||
print(' ' + e.login_command)
|
|
||||||
print('and re-run this command.')
|
|
||||||
return 0
|
return 0
|
||||||
if newauth.ExplicitlyDisabled():
|
if newauth.ExplicitlyDisabled():
|
||||||
git_auth.ClearRepoConfig(os.getcwd(), Changelist())
|
git_auth.ClearRepoConfig(os.getcwd(), Changelist())
|
||||||
@@ -3955,22 +3941,6 @@ def CMDcreds_check(parser, args):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def CMDcreds_check2(parser, args):
|
|
||||||
"""Checks credentials and suggests changes.
|
|
||||||
|
|
||||||
New wizard version, currently for testing use.
|
|
||||||
"""
|
|
||||||
_, _ = parser.parse_args(args)
|
|
||||||
cl = Changelist()
|
|
||||||
try:
|
|
||||||
remote_url = cl.GetRemoteUrl()
|
|
||||||
except subprocess2.CalledProcessError:
|
|
||||||
remote_url = ''
|
|
||||||
wizard = git_auth.ConfigWizard(git_auth.UserInterface(
|
|
||||||
sys.stdin, sys.stdout))
|
|
||||||
wizard.run(remote_url)
|
|
||||||
|
|
||||||
|
|
||||||
@metrics.collector.collect_metrics('git cl baseurl')
|
@metrics.collector.collect_metrics('git cl baseurl')
|
||||||
def CMDbaseurl(parser, args):
|
def CMDbaseurl(parser, args):
|
||||||
"""Gets or sets base-url for this branch."""
|
"""Gets or sets base-url for this branch."""
|
||||||
|
|||||||
Reference in New Issue
Block a user