mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
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>
This commit is contained in:
15
git_cl.py
15
git_cl.py
@@ -59,7 +59,6 @@ import split_cl
|
||||
import subcommand
|
||||
import subprocess2
|
||||
import swift_format
|
||||
import watchlists
|
||||
|
||||
|
||||
__version__ = '2.0'
|
||||
@@ -2009,9 +2008,6 @@ 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,
|
||||
@@ -2121,12 +2117,7 @@ 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:
|
||||
@@ -4847,7 +4838,8 @@ def CMDupload(parser, args):
|
||||
parser.add_option('--bypass-watchlists',
|
||||
action='store_true',
|
||||
dest='bypass_watchlists',
|
||||
help='bypass watchlists auto CC-ing reviewers')
|
||||
help='DEPRECATED: bypass watchlists auto CC-ing '
|
||||
'reviewers. This no longer has any effect.')
|
||||
parser.add_option('-f',
|
||||
'--force',
|
||||
action='store_true',
|
||||
@@ -5037,6 +5029,9 @@ 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,15 +113,6 @@ 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
|
||||
@@ -612,7 +603,6 @@ 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(
|
||||
@@ -939,7 +929,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', 'joe@example.com']
|
||||
cc += ['test-more-cc@chromium.org']
|
||||
for c in sorted(cc):
|
||||
ref_suffix_list.append('cc=%s' % c)
|
||||
metrics_arguments.append('cc')
|
||||
@@ -948,21 +938,18 @@ class TestGitCl(unittest.TestCase):
|
||||
# TODO(crbug/877717): remove this case.
|
||||
calls += [(('ValidAccounts',
|
||||
'%s-review.googlesource.com' % short_hostname,
|
||||
sorted(reviewers) +
|
||||
['joe@example.com', 'test-more-cc@chromium.org'] + cc),
|
||||
sorted(reviewers) + ['test-more-cc@chromium.org'] + cc),
|
||||
{
|
||||
e: {
|
||||
'email': e
|
||||
}
|
||||
for e in (reviewers + ['joe@example.com'] + cc)
|
||||
for e in (reviewers + 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')
|
||||
|
||||
Reference in New Issue
Block a user