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

Unified Diff: git_cl_hooks.py

Issue 6646009: update git-cl for OWNERS file support via .git/hooks/pre-cl-* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: clean up after running owners-related git-cl tests Created 9 years, 9 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 | « git_cl/test/owners.sh ('k') | presubmit_canned_checks.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl_hooks.py
diff --git a/git_cl_hooks.py b/git_cl_hooks.py
index e880a0b30d679775b05538d8dfeeb0bfe74896d6..e881085d0911293403cf01abe5bea42ef77e575d 100644
--- a/git_cl_hooks.py
+++ b/git_cl_hooks.py
@@ -32,12 +32,14 @@ def ConvertToInteger(inputval):
return None
-class ChangeOptions:
- def __init__(self, commit=None, upstream_branch=None):
+class ChangeOptions(object):
+ def __init__(self, commit, upstream_branch, cmd_line_options):
self.commit = commit
self.verbose = None
self.default_presubmit = None
self.may_prompt = None
+ self.host_url = cmd_line_options.host_url
+ self.tbr = cmd_line_options.tbr
root = Backquote(['git', 'rev-parse', '--show-cdup'])
if not root:
@@ -62,12 +64,20 @@ class ChangeOptions:
self.change = presubmit_support.GitChange(name, description, absroot, files,
issue, patchset)
+# TODO(dpranke): remove when we make cmd_line_options mandatory in RunHooks().
+class DefaultOptions(object):
+ tbr = False
+ host_url = None
+
+
+def RunHooks(hook_name, upstream_branch, cmd_line_options=None):
+ # TODO(dpranke): make cmd_line_options mandatory
+ cmd_line_options = cmd_line_options or DefaultOptions()
-def RunHooks(hook_name, upstream_branch):
commit = (hook_name == 'pre-cl-dcommit')
# Create our options based on the command-line args and the current checkout.
- options = ChangeOptions(commit=commit, upstream_branch=upstream_branch)
+ options = ChangeOptions(commit, upstream_branch, cmd_line_options)
# Apply watchlists on upload.
if not commit:
@@ -78,13 +88,16 @@ def RunHooks(hook_name, upstream_branch):
'rietveld.extracc', ','.join(watchers)])
# Run the presubmit checks.
+ # TODO(dpranke): just pass the whole options object?
if presubmit_support.DoPresubmitChecks(options.change,
options.commit,
options.verbose,
sys.stdout,
sys.stdin,
options.default_presubmit,
- options.may_prompt):
+ options.may_prompt,
+ options.tbr,
+ options.host_url):
sys.exit(0)
else:
sys.exit(1)
« no previous file with comments | « git_cl/test/owners.sh ('k') | presubmit_canned_checks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698