Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: git_cl.py

Issue 1884173003: Allow to skip EnsureAuthenticated for Gerrit. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 9bc7d52e753afacf9f65851cad597e78e03e5bca..eb66039a7154651415691a42cbfeb2a9960ad6eb 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -589,6 +589,7 @@ class Settings(object):
self.updated = False
self.is_gerrit = None
self.squash_gerrit_uploads = None
+ self.gerrit_skip_ensure_authenticated = None
self.git_editor = None
self.project = None
self.force_https_commit_url = None
@@ -771,6 +772,15 @@ class Settings(object):
error_ok=True).strip() == 'true')
return self.squash_gerrit_uploads
+ def GetGerritSkipEnsureAuthenticated(self):
+ """Return True if EnsureAuthenticated should not be done for Gerrit
+ uploads."""
+ if self.gerrit_skip_ensure_authenticated is None:
+ self.gerrit_skip_ensure_authenticated = (
+ RunGit(['config', '--bool', 'gerrit.skip_ensure_authenticated'],
+ error_ok=True).strip() == 'true')
+ return self.gerrit_skip_ensure_authenticated
+
def GetGitEditor(self):
"""Return the editor specified in the git config, or None if none is."""
if self.git_editor is None:
@@ -2022,6 +2032,10 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
def EnsureAuthenticated(self, force):
"""Best effort check that user is authenticated with Gerrit server."""
+ if settings.GetGerritSkipEnsureAuthenticated():
+ # For projects with unusual authentication schemes.
+ # See http://crbug.com/603378.
+ return
# Lazy-loader to identify Gerrit and Git hosts.
if gerrit_util.GceAuthenticator.is_gce():
return
@@ -2717,6 +2731,10 @@ def LoadCodereviewSettingsFromFile(fileobj):
RunGit(['config', 'gerrit.squash-uploads',
keyvals['GERRIT_SQUASH_UPLOADS']])
+ if 'GERRIT_SKIP_ENSURE_AUTHENTICATED' in keyvals:
+ RunGit(['config', 'gerrit.skip_ensure_authenticated',
+ keyvals['GERRIT_SKIP_ENSURE_AUTHENTICATED']])
+
if 'PUSH_URL_CONFIG' in keyvals and 'ORIGIN_URL_CONFIG' in keyvals:
#should be of the form
#PUSH_URL_CONFIG: url.ssh://gitrw.chromium.org.pushinsteadof
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698