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

Unified Diff: git_cl.py

Issue 12295004: Always add watchlists on upload (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: rebase Created 7 years, 10 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 | no next file » | 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 f3f783932b5dbb389e6330811aeec366cfad57cc..2fd5d852f15d892dc6ae968fbd2ceee33cdb4666 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -695,15 +695,8 @@ or verify this branch is set up to track another (via the --track argument to
patchset,
author)
- def RunHook(self, committing, upstream_branch, may_prompt, verbose, author):
+ def RunHook(self, committing, may_prompt, verbose, change):
"""Calls sys.exit() if the hook fails; returns a HookResults otherwise."""
- change = self.GetChange(upstream_branch, author)
-
- # Apply watchlists on upload.
- if not committing:
- watchlist = watchlists.Watchlists(change.RepositoryRoot())
- files = [f.LocalPath() for f in change.AffectedFiles()]
- self.SetWatchers(watchlist.GetWatchersForPaths(files))
try:
return presubmit_support.DoPresubmitChecks(change, committing,
@@ -1070,9 +1063,11 @@ def CMDpresubmit(parser, args):
# Default to diffing against the common ancestor of the upstream branch.
base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip()
- cl.RunHook(committing=not options.upload, upstream_branch=base_branch,
- may_prompt=False, verbose=options.verbose,
- author=None)
+ cl.RunHook(
+ committing=not options.upload,
+ may_prompt=False,
+ verbose=options.verbose,
+ change=cl.GetChange(base_branch, None))
return 0
@@ -1274,11 +1269,17 @@ def CMDupload(parser, args):
base_branch = RunGit(['merge-base', cl.GetUpstreamBranch(), 'HEAD']).strip()
args = [base_branch, 'HEAD']
+ # Apply watchlists on upload.
+ change = cl.GetChange(base_branch, None)
+ watchlist = watchlists.Watchlists(change.RepositoryRoot())
+ files = [f.LocalPath() for f in change.AffectedFiles()]
+ cl.SetWatchers(watchlist.GetWatchersForPaths(files))
+
if not options.bypass_hooks:
- hook_results = cl.RunHook(committing=False, upstream_branch=base_branch,
+ hook_results = cl.RunHook(committing=False,
may_prompt=not options.force,
verbose=options.verbose,
- author=None)
+ change=change)
if not hook_results.should_continue():
return 1
if not options.reviewers and hook_results.reviewers:
@@ -1371,10 +1372,9 @@ def SendUpstream(parser, args, cmd):
author = re.search(r'\<(.*)\>', options.contributor).group(1)
hook_results = cl.RunHook(
committing=True,
- upstream_branch=base_branch,
may_prompt=not options.force,
verbose=options.verbose,
- author=author)
+ change=cl.GetChange(base_branch, author))
if not hook_results.should_continue():
return 1
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698