[git_cl] Factor out _infer_mode() helper

Bug: b/351024645
Change-Id: Ia016f89f72a836eccfb8cbcb2c18508b4370e1c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5699187
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
changes/87/5699187/6
Allen Li 1 year ago committed by LUCI CQ
parent 779f70fd7c
commit 211104a00e

@ -3727,17 +3727,20 @@ class GitAuthConfigChanger(object):
# https://chromium.googlesource.com/chromium/tools/depot_tools.git
remote_url: str = cl.GetRemoteUrl()
mode: GitConfigMode = GitConfigMode.NEW_AUTH
if gerrit_util.ShouldUseSSO(gerrit_host):
mode = GitConfigMode.NEW_AUTH_SSO
return cls(
cwd=os.getcwd(),
host_shortname=host_shortname,
mode=mode,
mode=cls._infer_mode(),
remote_url=remote_url,
)
@staticmethod
def _infer_mode() -> GitConfigMode:
"""Infer default mode to use."""
if gerrit_util.ShouldUseSSO(gerrit_host):
return GitConfigMode.NEW_AUTH_SSO
return GitConfigMode.NEW_AUTH
def apply(self) -> None:
"""Apply config changes."""
self._apply_cred_helper()

Loading…
Cancel
Save