##// END OF EJS Templates
Implemented #628: Pass server URL to rc-extensions hooks...
marcink -
r2969:5085e51f beta
parent child Browse files
Show More
@@ -75,18 +75,21 b' DELETE_REPO_HOOK = _dlhook'
75 75 # POST PUSH HOOK
76 76 #==============================================================================
77 77
78 # this function will be executed after each push it's runned after the build-in
79 # hook that rhodecode uses for logging pushes
78 # this function will be executed after each push it's executed after the
79 # build-in hook that RhodeCode uses for logging pushes
80 80 def _pushhook(*args, **kwargs):
81 81 """
82 82 Post push hook
83 83 kwargs available:
84 84
85 :param server_url: url of instance that triggered this hook
86 :param config: path to .ini config used
87 :param scm: type of VS 'git' or 'hg'
85 88 :param username: name of user who pushed
86 89 :param ip: ip of who pushed
87 :param action: pull
90 :param action: push
88 91 :param repository: repository name
89 :param pushed_revs: generator of pushed revisions
92 :param pushed_revs: list of pushed revisions
90 93 """
91 94 return 0
92 95 PUSH_HOOK = _pushhook
@@ -96,15 +99,18 b' PUSH_HOOK = _pushhook'
96 99 # POST PULL HOOK
97 100 #==============================================================================
98 101
99 # this function will be executed after each push it's runned after the build-in
100 # hook that rhodecode uses for logging pushes
102 # this function will be executed after each push it's executed after the
103 # build-in hook that RhodeCode uses for logging pulls
101 104 def _pullhook(*args, **kwargs):
102 105 """
103 106 Post pull hook
104 107 kwargs available::
105 108
109 :param server_url: url of instance that triggered this hook
110 :param config: path to .ini config used
111 :param scm: type of VS 'git' or 'hg'
106 112 :param username: name of user who pulled
107 :param ip: ip of who pushed
113 :param ip: ip of who pulled
108 114 :param action: pull
109 115 :param repository: repository name
110 116 """
@@ -79,7 +79,7 b' from paste.httpheaders import REMOTE_USE'
79 79 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
80 80 HTTPBadRequest, HTTPNotAcceptable
81 81
82 from rhodecode.lib.utils2 import safe_str, fix_PATH
82 from rhodecode.lib.utils2 import safe_str, fix_PATH, get_server_url
83 83 from rhodecode.lib.base import BaseVCSController
84 84 from rhodecode.lib.auth import get_container_username
85 85 from rhodecode.lib.utils import is_valid_repo, make_ui
@@ -189,6 +189,7 b' class SimpleGit(BaseVCSController):'
189 189 # extras are injected into UI object and later available
190 190 # in hooks executed by rhodecode
191 191 from rhodecode import CONFIG
192 server_url = get_server_url(environ)
192 193 extras = {
193 194 'ip': ipaddr,
194 195 'username': username,
@@ -196,6 +197,7 b' class SimpleGit(BaseVCSController):'
196 197 'repository': repo_name,
197 198 'scm': 'git',
198 199 'config': CONFIG['__file__'],
200 'server_url': server_url,
199 201 'make_lock': None,
200 202 'locked_by': [None, None]
201 203 }
@@ -35,7 +35,7 b' from paste.httpheaders import REMOTE_USE'
35 35 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
36 36 HTTPBadRequest, HTTPNotAcceptable
37 37
38 from rhodecode.lib.utils2 import safe_str, fix_PATH
38 from rhodecode.lib.utils2 import safe_str, fix_PATH, get_server_url
39 39 from rhodecode.lib.base import BaseVCSController
40 40 from rhodecode.lib.auth import get_container_username
41 41 from rhodecode.lib.utils import make_ui, is_valid_repo, ui_sections
@@ -152,6 +152,7 b' class SimpleHg(BaseVCSController):'
152 152 # extras are injected into mercurial UI object and later available
153 153 # in hg hooks executed by rhodecode
154 154 from rhodecode import CONFIG
155 server_url = get_server_url(environ)
155 156 extras = {
156 157 'ip': ipaddr,
157 158 'username': username,
@@ -159,6 +160,7 b' class SimpleHg(BaseVCSController):'
159 160 'repository': repo_name,
160 161 'scm': 'hg',
161 162 'config': CONFIG['__file__'],
163 'server_url': server_url,
162 164 'make_lock': None,
163 165 'locked_by': [None, None]
164 166 }
@@ -26,6 +26,8 b''
26 26 import re
27 27 import time
28 28 import datetime
29 import webob
30
29 31 from pylons.i18n.translation import _, ungettext
30 32 from rhodecode.lib.vcs.utils.lazy import LazyProperty
31 33
@@ -516,3 +518,8 b' def obfuscate_url_pw(engine):'
516 518 if url.password:
517 519 url.password = 'XXXXX'
518 520 return str(url)
521
522
523 def get_server_url(environ):
524 req = webob.Request(environ)
525 return req.host_url + req.script_name
General Comments 0
You need to be logged in to leave comments. Login now