Commit 3e6d7c1c authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr Committed by Commit Bot

gclient: remove support for $matching_files in hooks

This feature seems to be unused, and removing it will
simplify handling hooks a little bit.

Bug: 661382
Change-Id: I89f28dedb7f59cd475b176cfb1f023094520d6b7
Reviewed-on: https://chromium-review.googlesource.com/509614Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
parent 568e5919
......@@ -724,7 +724,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
hooks_to_run.append(hook)
if self.recursion_limit:
self._pre_deps_hooks = [self.GetHookAction(hook, []) for hook in
self._pre_deps_hooks = [self.GetHookAction(hook) for hook in
local_scope.get('pre_deps_hooks', [])]
self.add_dependencies_and_close(deps_to_add, hooks_to_run)
......@@ -879,19 +879,15 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self._processed = True
@staticmethod
def GetHookAction(hook_dict, matching_file_list):
def GetHookAction(hook_dict):
"""Turns a parsed 'hook' dict into an executable command."""
logging.debug(hook_dict)
logging.debug(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
return command
def GetHooks(self, options):
......@@ -913,7 +909,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
gclient_scm.GetScmName(self.parsed_url) in ('git', None) or
os.path.isdir(os.path.join(self.root.root_dir, self.name, '.git'))):
for hook_dict in self.deps_hooks:
result.append(self.GetHookAction(hook_dict, []))
result.append(self.GetHookAction(hook_dict))
else:
# Run hooks on the basis of whether the files from the gclient operation
# match each hook's pattern.
......@@ -923,7 +919,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
f for f in self.file_list_and_children if pattern.search(f)
]
if matching_file_list:
result.append(self.GetHookAction(hook_dict, matching_file_list))
result.append(self.GetHookAction(hook_dict))
for s in self.dependencies:
result.extend(s.GetHooks(options))
return result
......
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