Skip to content
Snippets Groups Projects
Commit e83937b8 authored by Georges Racinet's avatar Georges Racinet
Browse files

GitLab hooks: option to skip them all

Because they are never called for other Git operations than
receiving pushes, they are not expected to be triggered by
local merges or imports.
parent 2ddd60f0
Branches
Tags
No related merge requests found
Pipeline #
......@@ -42,6 +42,8 @@
def environ(self):
base = self.repo.ui.environ
if base.get('HEPTAPOD_SKIP_ALL_GITLAB_HOOKS', '').strip() == 'yes':
return SKIP
if base.get('HEPTAPOD_SKIP_GITLAB_HOOK', '').strip() == self.name:
return SKIP
......
......@@ -124,3 +124,16 @@
repo.ui.environ['HEPTAPOD_SKIP_GITLAB_HOOK'] = 'pre-rcv'
hook = Hook('pre-rcv', repo)
assert hook(dict(master=(0, 1))) == (0, '', '')
def test_hook_skip_all(tmpdir):
wrapper = make_repo(tmpdir, 'proj2.hg')
repo = wrapper.repo
repo.ui.environ['HEPTAPOD_SKIP_ALL_GITLAB_HOOKS'] = 'no'
hook = Hook('pre-rcv', repo)
# it's been called and failed because of lack of User id
assert hook(dict(master=(0, 1)))[0] == 1
repo.ui.environ['HEPTAPOD_SKIP_ALL_GITLAB_HOOKS'] = 'yes'
hook = Hook('pre-rcv', repo)
assert hook(dict(master=(0, 1))) == (0, '', '')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment