Kaynağa Gözat

Improve printed info in git cl creds-check

May help user to diagnose/debug some issues.

Bug: b/372552465
Change-Id: Ia9fc4fd49c8ee80bccd98442ed5589324d0b23b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6068966
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Allen Li <ayatane@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
Allen Li 8 ay önce
ebeveyn
işleme
d2fdba4e78
1 değiştirilmiş dosya ile 8 ekleme ve 2 silme
  1. 8 2
      git_cl.py

+ 8 - 2
git_cl.py

@@ -3888,17 +3888,23 @@ def CMDcreds_check(parser, args):
 
 
     if newauth.Enabled():
     if newauth.Enabled():
         cl = Changelist()
         cl = Changelist()
+        host = cl.GetGerritHost()
+        print(f'Using Gerrit host: {host!r}')
         git_auth.Configure(os.getcwd(), cl)
         git_auth.Configure(os.getcwd(), cl)
         # Perform some advisory checks
         # Perform some advisory checks
         email = scm.GIT.GetConfig(os.getcwd(), 'user.email') or ''
         email = scm.GIT.GetConfig(os.getcwd(), 'user.email') or ''
-        if not gerrit_util.ShouldUseSSO(cl.GetGerritHost(), email):
+        print(f'Using email (configured in Git): {email!r}')
+        if gerrit_util.ShouldUseSSO(host, email):
+            print('Detected that we should be using SSO.')
+        else:
+            print('Detected that we should be using luci-auth.')
             a = gerrit_util.LuciAuthAuthenticator()
             a = gerrit_util.LuciAuthAuthenticator()
             try:
             try:
                 a.luci_auth.get_access_token()
                 a.luci_auth.get_access_token()
             except auth.LoginRequiredError as e:
             except auth.LoginRequiredError as e:
                 print('NOTE: You are not logged in with luci-auth.')
                 print('NOTE: You are not logged in with luci-auth.')
                 print(
                 print(
-                    'You may not be able to perform some actions without logging in.'
+                    'You will not be able to perform many actions without logging in.'
                 )
                 )
                 print('If you wish to log in, run:')
                 print('If you wish to log in, run:')
                 print('   ' + e.login_command)
                 print('   ' + e.login_command)