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

Side by Side Diff: git-cl-upload-hook

Issue 281007: Fixes based on maruel's comments. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 import sys 7 import sys
8 8
9 # Try locating depot_tools from the user's PATH. 9 # Try locating depot_tools from the user's PATH.
10 depot_tools_path = None 10 depot_tools_path = None
11 for path in os.environ.get("PATH").split(':'): 11 for path in os.environ.get("PATH").split(os.pathsep):
12 if not path.endswith("depot_tools"): 12 if not path.endswith("depot_tools"):
13 continue 13 continue
14 depot_tools_path = path 14 depot_tools_path = path
15 break 15 break
16 16
17 # If we found depot_tools, add it to the script's import path. 17 # If we found depot_tools, add it to the script's import path.
18 if depot_tools_path: 18 if depot_tools_path:
19 sys.path.append(depot_tools_path) 19 sys.path.append(depot_tools_path)
20 else: 20 else:
21 print "ERROR: Could not find depot_tools in your PATH." 21 print "ERROR: Could not find depot_tools in your PATH."
22 print "ERROR: Please add it to your PATH and try again." 22 print "ERROR: Please add it to your PATH and try again."
23 sys.exit(1) 23 sys.exit(1)
24 24
25 # Try importing git_cl_hooks from depot_tools. 25 # Try importing git_cl_hooks from depot_tools.
26 try: 26 try:
27 import git_cl_hooks 27 import git_cl_hooks
28 except ImportError: 28 except ImportError:
29 print ("ERROR: Could not import git_cl_hooks from your depot_tools at %s." % 29 print "ERROR: Could not import git_cl_hooks from depot_tools in your PATH."
30 depot_tools_path)
31 print "ERROR: Make sure %s is up-to-date and try again." % depot_tools_path 30 print "ERROR: Make sure %s is up-to-date and try again." % depot_tools_path
32 sys.exit(1) 31 sys.exit(1)
33 32
34 # Ensure we were called with the necessary number of arguments. 33 # Ensure we were called with the necessary number of arguments.
35 program_name = os.path.basename(sys.argv[0]) 34 program_name = os.path.basename(sys.argv[0])
36 if len(sys.argv) != 2: 35 if len(sys.argv) != 2:
37 print "usage: %s [upstream branch]" % program_name 36 print "usage: %s [upstream branch]" % program_name
38 sys.exit(1) 37 sys.exit(1)
39 38
40 # Run the hooks library with our arguments. 39 # Run the hooks library with our arguments.
41 exec git_cl_hooks.RunHooks(hook_name=program_name, upstream_branch=sys.argv[1]) 40 exec git_cl_hooks.RunHooks(hook_name=program_name, upstream_branch=sys.argv[1])
OLDNEW
« 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