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

Unified Diff: git_cl_hooks.py

Issue 243118: Alter hooks to call into depot_tools lib.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 11 years, 2 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-upload-hook ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl_hooks.py
===================================================================
--- git_cl_hooks.py (revision 28091)
+++ git_cl_hooks.py (working copy)
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -8,14 +7,7 @@
import subprocess
import sys
-# Find depot_tools in PATH, append it to sys.path so we can import.
-paths = os.environ.get("PATH")
-for path in paths.split(':'):
- if not path.endswith("depot_tools"):
- continue
- sys.path.append(path)
- break
-
+# Imported from depot_tools.
import gclient_scm
import presubmit_support
@@ -50,26 +42,20 @@
issue, patchset)
-# Ensure we were called with the necessary number of arguments.
-program_name = os.path.basename(sys.argv[0])
-if len(sys.argv) < 2:
- raise Exception("usage: %s [upstream branch]" % program_name)
+def RunHooks(hook_name, upstream_branch):
+ commit = (hook_name == 'pre-cl-dcommit')
-# Get arguments from how we were called.
-commit = (program_name == 'pre-cl-dcommit')
-upstream_branch = sys.argv[1]
+ # Create our options based on the command-line args and the current checkout.
+ options = ChangeOptions(commit=commit, upstream_branch=upstream_branch)
-# Create our options based on the command-line args and the current checkout.
-options = ChangeOptions(commit=commit, upstream_branch=upstream_branch)
-
-# Run the presubmit checks.
-if presubmit_support.DoPresubmitChecks(options.change,
- options.commit,
- options.verbose,
- sys.stdout,
- sys.stdin,
- options.default_presubmit,
- options.may_prompt):
- sys.exit(0)
-else:
- sys.exit(1)
+ # Run the presubmit checks.
+ if presubmit_support.DoPresubmitChecks(options.change,
+ options.commit,
+ options.verbose,
+ sys.stdout,
+ sys.stdin,
+ options.default_presubmit,
+ options.may_prompt):
+ sys.exit(0)
+ else:
+ sys.exit(1)
Property changes on: git_cl_hooks.py
___________________________________________________________________
Deleted: svn:executable
- *
« no previous file with comments | « git-cl-upload-hook ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698