[gerrit_util] Configure new auth automatically

Because running git cl creds-check in every single repo is poor UX for
early dogfooders.

Bug: b/348024314
Change-Id: Ib5641418de7fa5a55a7f67b7069e63c04403852a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5660338
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
changes/38/5660338/8
Allen Li 11 months ago committed by LUCI CQ
parent ea366e35f0
commit 6a00e594c9

@ -2306,6 +2306,26 @@ class Changelist(object):
})
return
if newauth.Enabled():
latestVer = 1
v: int = 0
try:
v = int(
scm.GIT.GetConfig(settings.GetRoot(),
'depot-tools.gitauthautoconfigured',
default='0'))
except ValueError:
v = 0
if v < latestVer:
logging.debug(
'Automatically configuring Git repo authentication (current version: %r, latest: %r)',
v, latestVer)
ConfigureGitRepoAuth()
scm.GIT.SetConfig(settings.GetRoot(),
'depot-tools.gitAuthAutoConfigured',
str(latestVer))
return
# Lazy-loader to identify Gerrit and Git hosts.
self.GetCodereviewServer()
git_host = self._GetGitHost()

Loading…
Cancel
Save