From eaf6106fdf5bc9e12aae20243d7a6de626b5c71c Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 7 Jul 2010 18:42:39 +0000 Subject: [PATCH] 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 --- gclient.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/gclient.py b/gclient.py index e3596b9fd..04087100c 100644 --- a/gclient.py +++ b/gclient.py @@ -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()