Revert "Deprecate --bypass-watchlists flag"

This reverts commit e98e458a9f.

Reason for revert: keep depot_tools CCing watchers while b/324466185 is open

Original change's description:
> Deprecate --bypass-watchlists flag
>
> CCing watchers is now handled by the Watchlists AyeAye analyzer on
> all Gerrit projects that use it, and not CCing watchers locally has
> no effect. Rely on that instead of logic in git cl.
>
> Bug: 41494851, 40242793
> Change-Id: I58fdf8c0a741a9189cccec3b3b56d0a8a1c44058
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5276660
> Reviewed-by: Scott Lee <ddoman@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 41494851, 40242793
Change-Id: Ied75beb163b2628343d4dcac5819b5bd77854de8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5281700
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Gavin Mak <gavinmak@google.com>
changes/00/5281700/2
Gavin Mak 2 years ago committed by LUCI CQ
parent aa475e6a12
commit 32769fe939

@ -59,6 +59,7 @@ import split_cl
import subcommand
import subprocess2
import swift_format
import watchlists
__version__ = '2.0'
@ -2008,6 +2009,9 @@ class Changelist(object):
files = self.GetAffectedFiles(parent, end_commit=end_commit)
change_desc = self._GetDescriptionForUpload(options,
[parent, end_commit], files)
watchlist = watchlists.Watchlists(settings.GetRoot())
self.ExtendCC(watchlist.GetWatchersForPaths(files))
if not options.bypass_hooks:
hook_results = self.RunHook(committing=False,
may_prompt=not options.force,
@ -2117,7 +2121,12 @@ class Changelist(object):
print(f'Processing {_GetCommitCountSummary(*git_diff_args)}...')
# Apply watchlists on upload.
watchlist = watchlists.Watchlists(settings.GetRoot())
files = self.GetAffectedFiles(base_branch)
if not options.bypass_watchlists:
self.ExtendCC(watchlist.GetWatchersForPaths(files))
change_desc = self._GetDescriptionForUpload(options, git_diff_args,
files)
if not options.bypass_hooks:
@ -4838,8 +4847,7 @@ def CMDupload(parser, args):
parser.add_option('--bypass-watchlists',
action='store_true',
dest='bypass_watchlists',
help='DEPRECATED: bypass watchlists auto CC-ing '
'reviewers. This no longer has any effect.')
help='bypass watchlists auto CC-ing reviewers')
parser.add_option('-f',
'--force',
action='store_true',
@ -5029,9 +5037,6 @@ def CMDupload(parser, args):
if options.skip_title and options.title:
parser.error('Only one of --title and --skip-title allowed.')
if options.bypass_watchlists:
print('The --bypass-watchlists flag is deprecated and has no effect.')
if options.use_commit_queue:
options.send_mail = True

@ -113,6 +113,15 @@ class GitMocks(object):
del self.config[key]
class WatchlistsMock(object):
def __init__(self, _):
pass
@staticmethod
def GetWatchersForPaths(_):
return ['joe@example.com']
class CodereviewSettingsFileMock(object):
def __init__(self):
pass
@ -603,6 +612,7 @@ class TestGitCl(unittest.TestCase):
return_value={
'more_cc': ['test-more-cc@chromium.org']
}).start()
mock.patch('git_cl.watchlists.Watchlists', WatchlistsMock).start()
mock.patch('git_cl.auth.Authenticator', AuthenticatorMock).start()
mock.patch('gerrit_util.GetChangeDetail').start()
mock.patch(
@ -929,7 +939,7 @@ class TestGitCl(unittest.TestCase):
ref_suffix_list.append('r=%s' % r)
metrics_arguments.append('r')
if issue is None:
cc += ['test-more-cc@chromium.org']
cc += ['test-more-cc@chromium.org', 'joe@example.com']
for c in sorted(cc):
ref_suffix_list.append('cc=%s' % c)
metrics_arguments.append('cc')
@ -938,18 +948,21 @@ class TestGitCl(unittest.TestCase):
# TODO(crbug/877717): remove this case.
calls += [(('ValidAccounts',
'%s-review.googlesource.com' % short_hostname,
sorted(reviewers) + ['test-more-cc@chromium.org'] + cc),
sorted(reviewers) +
['joe@example.com', 'test-more-cc@chromium.org'] + cc),
{
e: {
'email': e
}
for e in (reviewers + cc)
for e in (reviewers + ['joe@example.com'] + cc)
})]
for r in sorted(reviewers):
if r != 'bad-account-or-email':
ref_suffix_list.append('r=%s' % r)
metrics_arguments.append('r')
reviewers.remove(r)
if issue is None:
cc += ['joe@example.com']
for c in sorted(cc):
ref_suffix_list.append('cc=%s' % c)
metrics_arguments.append('cc')

Loading…
Cancel
Save