Allow users to mute stacked changes dogfood message.
Bug: 1443304
Change-Id: Idecda2ca5e059c069f38cf099e83e7e0ae932ce2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4537944
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index b97ed25..ab6ad73 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4762,9 +4762,15 @@
print('No previous patchsets, so --retry-failed has no effect.')
options.retry_failed = False
- dogfood_stacked_changes = os.environ.get(DOGFOOD_STACKED_CHANGES_VAR) != '0'
- if dogfood_stacked_changes:
+ disable_dogfood_stacked_changes = os.environ.get(
+ DOGFOOD_STACKED_CHANGES_VAR) == '0'
+ dogfood_stacked_changes = os.environ.get(DOGFOOD_STACKED_CHANGES_VAR) == '1'
+
+ # Only print message for folks who don't have DOGFOOD_STACKED_CHANGES set
+ # to an expected value.
+ if (options.squash and not dogfood_stacked_changes
+ and not disable_dogfood_stacked_changes):
print(
'This repo has been enrolled in the stacked changes dogfood.\n'
'`git cl upload` now uploads the current branch and all upstream '
@@ -4772,13 +4778,16 @@
'Patches can now be reapplied with --force:\n'
'`git cl patch --reapply --force`.\n'
'Googlers may visit go/stacked-changes-dogfood for more information.\n'
- 'To opt-out use `export DOGFOOD_STACKED_CHANGES=0`. '
+ '\n'
+ 'Depot Tools no longer sets new uploads to "WIP". Please update the\n'
+ '"Set new changes to "work in progress" by default" checkbox at\n'
+ 'https://<host>-review.googlesource.com/settings/\n'
+ '\n'
+ 'To opt-out use `export DOGFOOD_STACKED_CHANGES=0`.\n'
+ 'To hide this message use `export DOGFOOD_STACKED_CHANGES=1`.\n'
'File bugs at https://bit.ly/3Y6opoI\n')
- if options.squash and dogfood_stacked_changes:
- print('Depot Tools no longer sets new uploads to "WIP". Please update the\n'
- '"Set new changes to "work in progress" by default" checkbox at\n'
- 'https://<host>-review.googlesource.com/settings/\n')
+ if options.squash and not disable_dogfood_stacked_changes:
if options.dependencies:
parser.error('--dependencies is not available for this dogfood workflow.')