Commit eaf6106f authored by maruel@chromium.org's avatar maruel@chromium.org

Move _RunHooks() higher to simplify the diff. NO CODE CHANGE.

Review URL: http://codereview.chromium.org/2885021

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@51746 0039d316-1c4b-4281-b951-d872f2087c98
parent 5990f9d5
......@@ -314,26 +314,6 @@ class Dependency(GClientKeywords):
deps[d] = url
return deps
def _RunHookAction(self, hook_dict, matching_file_list):
"""Runs the action from a single hook."""
logging.info(hook_dict)
logging.info(matching_file_list)
command = hook_dict['action'][:]
if command[0] == 'python':
# If the hook specified "python" as the first item, the action is a
# Python script. Run it by starting a new copy of the same
# interpreter.
command[0] = sys.executable
if '$matching_files' in command:
splice_index = command.index('$matching_files')
command[splice_index:splice_index + 1] = matching_file_list
# Use a discrete exit status code of 2 to indicate that a hook action
# failed. Users of this script may wish to treat hook action failures
# differently from VC failures.
return gclient_utils.SubprocessCall(command, self.root_dir(), fail_status=2)
def _RunHooks(self, command, file_list, is_using_git):
"""Evaluates all hooks, running actions as needed.
"""
......@@ -367,6 +347,26 @@ class Dependency(GClientKeywords):
if matching_file_list:
self._RunHookAction(hook_dict, matching_file_list)
def _RunHookAction(self, hook_dict, matching_file_list):
"""Runs the action from a single hook."""
logging.info(hook_dict)
logging.info(matching_file_list)
command = hook_dict['action'][:]
if command[0] == 'python':
# If the hook specified "python" as the first item, the action is a
# Python script. Run it by starting a new copy of the same
# interpreter.
command[0] = sys.executable
if '$matching_files' in command:
splice_index = command.index('$matching_files')
command[splice_index:splice_index + 1] = matching_file_list
# Use a discrete exit status code of 2 to indicate that a hook action
# failed. Users of this script may wish to treat hook action failures
# differently from VC failures.
return gclient_utils.SubprocessCall(command, self.root_dir(), fail_status=2)
def root_dir(self):
return self.parent.root_dir()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment