diff --git a/git_cl_hooks.py b/git_cl_hooks.py index 81d48cea0..70c4f3201 100644 --- a/git_cl_hooks.py +++ b/git_cl_hooks.py @@ -11,6 +11,7 @@ import breakpad import presubmit_support import scm +import watchlists def Backquote(cmd, cwd=None): """Like running `cmd` in a shell script.""" @@ -52,6 +53,14 @@ def RunHooks(hook_name, upstream_branch): # Create our options based on the command-line args and the current checkout. options = ChangeOptions(commit=commit, upstream_branch=upstream_branch) + # Apply watchlists on upload. + if not commit: + watchlist = watchlists.Watchlists(options.change.RepositoryRoot()) + files = [f.LocalPath() for f in options.change.AffectedFiles()] + watchers = watchlist.GetWatchersForPaths(files) + Backquote(['git', 'config', '--add', + 'rietveld.extra_cc', ','.join(watchers)]) + # Run the presubmit checks. if presubmit_support.DoPresubmitChecks(options.change, options.commit,