@@ -75,18 +75,21 @@ DELETE_REPO_HOOK = _dlhook
# POST PUSH HOOK
#==============================================================================
# this function will be executed after each push it's runned after the build-in
# hook that rhodecode uses for logging pushes
# this function will be executed after each push it's executed after the
# build-in hook that RhodeCode uses for logging pushes
def _pushhook(*args, **kwargs):
"""
Post push hook
kwargs available:
:param server_url: url of instance that triggered this hook
:param config: path to .ini config used
:param scm: type of VS 'git' or 'hg'
:param username: name of user who pushed
:param ip: ip of who pushed
:param action: pull
:param action: push
:param repository: repository name
:param pushed_revs: generator of pushed revisions
:param pushed_revs: list of pushed revisions
return 0
PUSH_HOOK = _pushhook
@@ -96,15 +99,18 @@ PUSH_HOOK = _pushhook
# POST PULL HOOK
# build-in hook that RhodeCode uses for logging pulls
def _pullhook(*args, **kwargs):
Post pull hook
kwargs available::
:param username: name of user who pulled
:param ip: ip of who pulled
@@ -79,7 +79,7 @@ from paste.httpheaders import REMOTE_USE
from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
HTTPBadRequest, HTTPNotAcceptable
from rhodecode.lib.utils2 import safe_str, fix_PATH
from rhodecode.lib.utils2 import safe_str, fix_PATH, get_server_url
from rhodecode.lib.base import BaseVCSController
from rhodecode.lib.auth import get_container_username
from rhodecode.lib.utils import is_valid_repo, make_ui
@@ -189,6 +189,7 @@ class SimpleGit(BaseVCSController):
# extras are injected into UI object and later available
# in hooks executed by rhodecode
from rhodecode import CONFIG
server_url = get_server_url(environ)
extras = {
'ip': ipaddr,
'username': username,
@@ -196,6 +197,7 @@ class SimpleGit(BaseVCSController):
'repository': repo_name,
'scm': 'git',
'config': CONFIG['__file__'],
'server_url': server_url,
'make_lock': None,
'locked_by': [None, None]
}
@@ -35,7 +35,7 @@ from paste.httpheaders import REMOTE_USE
from rhodecode.lib.utils import make_ui, is_valid_repo, ui_sections
@@ -152,6 +152,7 @@ class SimpleHg(BaseVCSController):
# extras are injected into mercurial UI object and later available
# in hg hooks executed by rhodecode
@@ -159,6 +160,7 @@ class SimpleHg(BaseVCSController):
'scm': 'hg',
@@ -26,6 +26,8 @@
import re
import time
import datetime
import webob
from pylons.i18n.translation import _, ungettext
from rhodecode.lib.vcs.utils.lazy import LazyProperty
@@ -516,3 +518,8 @@ def obfuscate_url_pw(engine):
if url.password:
url.password = 'XXXXX'
return str(url)
def get_server_url(environ):
req = webob.Request(environ)
return req.host_url + req.script_name
Status change: