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

Unified Diff: git_cl.py

Issue 2071413002: Abandoned. Gerrit git cl upload: warn users assuming --no-squash by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@debuggability
Patch Set: fix Created 4 years, 6 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 8407eb001a2efcfb962835aeaf35c0fe5697adda..c236a8aed74f98741037551e16445acef863989c 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -770,11 +770,28 @@ class Settings(object):
def GetSquashGerritUploads(self):
"""Return true if uploads to Gerrit should be squashed by default."""
if self.squash_gerrit_uploads is None:
- self.squash_gerrit_uploads = (
- RunGit(['config', '--bool', 'gerrit.squash-uploads'],
- error_ok=True).strip() == 'true')
+ self.squash_gerrit_uploads = self.GetSquashGerritUploadsOverride()
+ if self.squash_gerrit_uploads is None:
+ # TODO(tandrii): switch this from ==true to not ==false.
+ self.squash_gerrit_uploads = (
+ RunGit(['config', '--bool', 'gerrit.squash-uploads'],
+ error_ok=True).strip() == 'true')
return self.squash_gerrit_uploads
+ def GetSquashGerritUploadsOverride(self):
+ """Return True or False if codereview.settings should be overridden.
+
+ Returns None if no override has been defined.
+ """
+ # See also http://crbug.com/611892#c23
+ result = RunGit(['config', '--bool', 'gerrit.override-squash-uploads'],
+ error_ok=True).strip()
+ if result == 'true':
+ return True
+ if result == 'false':
+ return False
+ return None
+
def GetGerritSkipEnsureAuthenticated(self):
"""Return True if EnsureAuthenticated should not be done for Gerrit
uploads."""
@@ -2338,8 +2355,22 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
"""Upload the current branch to Gerrit."""
if options.squash and options.no_squash:
DieWithError('Can only use one of --squash or --no-squash')
- options.squash = ((settings.GetSquashGerritUploads() or options.squash) and
- not options.no_squash)
+
+ if not options.squash and not options.no_squash:
+ options.squash = settings.GetSquashGerritUploads()
+ # TODO(tandrii): remove this by June 20.
+ if (settings.GetSquashGerritUploadsOverride() is None and
+ not options.squash):
+ print('\n\nYou are using git cl upload in --no-squash mode '
+ 'by default.\n'
+ 'Chrome infrastructure wants to make --squash the default.\n'
+ 'To ensure that --no-squash is still the default for YOU do:\n'
+ ' git config --bool gerrit.override-squash-uploads false\n'
+ 'See https://goo.gl/dnK2gV (use chromium.org account!) and '
+ 'let us know what you think. Thanks!\n'
+ 'BUG: http://crbug.com/611892\n\n')
+ elif options.no_squash:
+ options.squash = False
# We assume the remote called "origin" is the one we want.
# It is probably not worthwhile to support different workflows.
« 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