diff --git a/vcsserver/hooks.py b/vcsserver/hooks.py --- a/vcsserver/hooks.py +++ b/vcsserver/hooks.py @@ -270,6 +270,7 @@ def pre_push(ui, repo, node=None, **kwar for push_ref in rev_data: push_ref['multiple_heads'] = _heads + extras['hook_type'] = kwargs.get('hooktype', 'pre_push') extras['commit_ids'] = rev_data return _call_hook('pre_push', extras, HgMessageWriter(ui)) @@ -319,6 +320,7 @@ def post_push(ui, repo, node, **kwargs): if hasattr(ui, '_rc_pushkey_branches'): bookmarks = ui._rc_pushkey_branches + extras['hook_type'] = kwargs.get('hooktype', 'post_push') extras['commit_ids'] = commit_ids extras['new_refs'] = { 'branches': branches, @@ -476,6 +478,7 @@ def git_pre_receive(unused_repo_path, re if stdout: push_ref['pruned_sha'] = stdout.splitlines() + extras['hook_type'] = 'pre_receive' extras['commit_ids'] = rev_data return _call_hook('pre_push', extras, GitMessageWriter()) @@ -555,6 +558,7 @@ def git_post_receive(unused_repo_path, r tags.append(push_ref['name']) git_revs.append('tag=>%s' % push_ref['name']) + extras['hook_type'] = 'post_receive' extras['commit_ids'] = git_revs extras['new_refs'] = { 'branches': branches, diff --git a/vcsserver/tests/fixture.py b/vcsserver/tests/fixture.py --- a/vcsserver/tests/fixture.py +++ b/vcsserver/tests/fixture.py @@ -77,7 +77,7 @@ def no_newline_id_generator(test_name): nicer output of progress of test """ org_name = test_name - test_name = test_name\ + test_name = str(test_name)\ .replace('\n', '_N') \ .replace('\r', '_N') \ .replace('\t', '_T') \ diff --git a/vcsserver/tests/test_hooks.py b/vcsserver/tests/test_hooks.py --- a/vcsserver/tests/test_hooks.py +++ b/vcsserver/tests/test_hooks.py @@ -70,7 +70,7 @@ def test_git_post_receive_calls_repo_siz with mock.patch.object(hooks, '_call_hook') as call_hook_mock: hooks.git_post_receive( None, '', {'RC_SCM_DATA': json.dumps(extras)}) - extras.update({'commit_ids': [], + extras.update({'commit_ids': [], 'hook_type': 'post_receive', 'new_refs': {'bookmarks': [], 'branches': [], 'tags': []}}) expected_calls = [ mock.call('repo_size', extras, mock.ANY), @@ -84,7 +84,7 @@ def test_git_post_receive_does_not_call_ with mock.patch.object(hooks, '_call_hook') as call_hook_mock: hooks.git_post_receive( None, '', {'RC_SCM_DATA': json.dumps(extras)}) - extras.update({'commit_ids': [], + extras.update({'commit_ids': [], 'hook_type': 'post_receive', 'new_refs': {'bookmarks': [], 'branches': [], 'tags': []}}) expected_calls = [ mock.call('post_push', extras, mock.ANY)