Filtering of hooks for commit or push stages

This commit is contained in:
Barry Steyn
2015-10-02 12:54:25 -07:00
committed by Travis CI
parent e3a22061c5
commit dd73ffd02f
8 changed files with 89 additions and 3 deletions

View File

@@ -20,10 +20,11 @@ PREVIOUS_IDENTIFYING_HASHES = (
'4d9958c90bc262f47553e2c073f14cfe',
'd8ee923c46731b42cd95cc869add4062',
'49fd668cb42069aa1b6048464be5d395',
'79f09a650522a87b0da915d0d983b2de'
)
IDENTIFYING_HASH = '79f09a650522a87b0da915d0d983b2de'
IDENTIFYING_HASH = 'e358c9dae00eac5d06b38dfdb1e33a8c'
def is_our_pre_commit(filename):

View File

@@ -175,6 +175,7 @@ def run(runner, args, write=sys_stdout_write_wrapper, environ=os.environ):
with ctx:
repo_hooks = list(get_repo_hooks(runner))
if args.hook:
repo_hooks = [
(repo, hook) for repo, hook in repo_hooks
@@ -183,4 +184,11 @@ def run(runner, args, write=sys_stdout_write_wrapper, environ=os.environ):
if not repo_hooks:
write('No hook with id `{0}`\n'.format(args.hook))
return 1
# Filter hooks for stages
repo_hooks = [
(repo, hook) for repo, hook in repo_hooks
if not hook['stages'] or args.hook_stage in hook['stages']
]
return _run_hooks(repo_hooks, args, write, environ)