##// END OF EJS Templates
hooks: store hook type for extensions.
marcink -
r555:315f8a04 default
parent child Browse files
Show More
@@ -270,6 +270,7 b' def pre_push(ui, repo, node=None, **kwar'
270 for push_ref in rev_data:
270 for push_ref in rev_data:
271 push_ref['multiple_heads'] = _heads
271 push_ref['multiple_heads'] = _heads
272
272
273 extras['hook_type'] = kwargs.get('hooktype', 'pre_push')
273 extras['commit_ids'] = rev_data
274 extras['commit_ids'] = rev_data
274 return _call_hook('pre_push', extras, HgMessageWriter(ui))
275 return _call_hook('pre_push', extras, HgMessageWriter(ui))
275
276
@@ -319,6 +320,7 b' def post_push(ui, repo, node, **kwargs):'
319 if hasattr(ui, '_rc_pushkey_branches'):
320 if hasattr(ui, '_rc_pushkey_branches'):
320 bookmarks = ui._rc_pushkey_branches
321 bookmarks = ui._rc_pushkey_branches
321
322
323 extras['hook_type'] = kwargs.get('hooktype', 'post_push')
322 extras['commit_ids'] = commit_ids
324 extras['commit_ids'] = commit_ids
323 extras['new_refs'] = {
325 extras['new_refs'] = {
324 'branches': branches,
326 'branches': branches,
@@ -476,6 +478,7 b' def git_pre_receive(unused_repo_path, re'
476 if stdout:
478 if stdout:
477 push_ref['pruned_sha'] = stdout.splitlines()
479 push_ref['pruned_sha'] = stdout.splitlines()
478
480
481 extras['hook_type'] = 'pre_receive'
479 extras['commit_ids'] = rev_data
482 extras['commit_ids'] = rev_data
480 return _call_hook('pre_push', extras, GitMessageWriter())
483 return _call_hook('pre_push', extras, GitMessageWriter())
481
484
@@ -555,6 +558,7 b' def git_post_receive(unused_repo_path, r'
555 tags.append(push_ref['name'])
558 tags.append(push_ref['name'])
556 git_revs.append('tag=>%s' % push_ref['name'])
559 git_revs.append('tag=>%s' % push_ref['name'])
557
560
561 extras['hook_type'] = 'post_receive'
558 extras['commit_ids'] = git_revs
562 extras['commit_ids'] = git_revs
559 extras['new_refs'] = {
563 extras['new_refs'] = {
560 'branches': branches,
564 'branches': branches,
@@ -77,7 +77,7 b' def no_newline_id_generator(test_name):'
77 nicer output of progress of test
77 nicer output of progress of test
78 """
78 """
79 org_name = test_name
79 org_name = test_name
80 test_name = test_name\
80 test_name = str(test_name)\
81 .replace('\n', '_N') \
81 .replace('\n', '_N') \
82 .replace('\r', '_N') \
82 .replace('\r', '_N') \
83 .replace('\t', '_T') \
83 .replace('\t', '_T') \
@@ -70,7 +70,7 b' def test_git_post_receive_calls_repo_siz'
70 with mock.patch.object(hooks, '_call_hook') as call_hook_mock:
70 with mock.patch.object(hooks, '_call_hook') as call_hook_mock:
71 hooks.git_post_receive(
71 hooks.git_post_receive(
72 None, '', {'RC_SCM_DATA': json.dumps(extras)})
72 None, '', {'RC_SCM_DATA': json.dumps(extras)})
73 extras.update({'commit_ids': [],
73 extras.update({'commit_ids': [], 'hook_type': 'post_receive',
74 'new_refs': {'bookmarks': [], 'branches': [], 'tags': []}})
74 'new_refs': {'bookmarks': [], 'branches': [], 'tags': []}})
75 expected_calls = [
75 expected_calls = [
76 mock.call('repo_size', extras, mock.ANY),
76 mock.call('repo_size', extras, mock.ANY),
@@ -84,7 +84,7 b' def test_git_post_receive_does_not_call_'
84 with mock.patch.object(hooks, '_call_hook') as call_hook_mock:
84 with mock.patch.object(hooks, '_call_hook') as call_hook_mock:
85 hooks.git_post_receive(
85 hooks.git_post_receive(
86 None, '', {'RC_SCM_DATA': json.dumps(extras)})
86 None, '', {'RC_SCM_DATA': json.dumps(extras)})
87 extras.update({'commit_ids': [],
87 extras.update({'commit_ids': [], 'hook_type': 'post_receive',
88 'new_refs': {'bookmarks': [], 'branches': [], 'tags': []}})
88 'new_refs': {'bookmarks': [], 'branches': [], 'tags': []}})
89 expected_calls = [
89 expected_calls = [
90 mock.call('post_push', extras, mock.ANY)
90 mock.call('post_push', extras, mock.ANY)
General Comments 0
You need to be logged in to leave comments. Login now