@@ -108,13 +108,13 @@ def log_pull_action(ui, repo, **kwargs):
def log_push_action(ui, repo, **kwargs):
"""
Maps user last push action to new changeset id, from mercurial
:param ui:
:param repo:
:param repo: repo object containing the `ui` object
extras = dict(repo.ui.configitems('rhodecode_extras'))
username = extras['username']
repository = extras['repository']
action = extras['action'] + ':%s'
@@ -198,13 +198,13 @@ class SimpleGit(BaseVCSController):
try:
# invalidate cache on push
if action == 'push':
self._invalidate_cache(repo_name)
self._handle_githooks(action, baseui, environ)
self._handle_githooks(repo_name, action, baseui, environ)
log.info('%s action on GIT repo "%s"' % (action, repo_name))
app = self.__make_app(repo_name, repo_path)
return app(environ, start_response)
except Exception:
log.error(traceback.format_exc())
@@ -261,13 +261,13 @@ class SimpleGit(BaseVCSController):
else:
# try to fallback to stored variable as we don't know if the last
# operation is pull/push
op = getattr(self, '_git_stored_op', 'pull')
return op
def _handle_githooks(self, action, baseui, environ):
def _handle_githooks(self, repo_name, action, baseui, environ):
from rhodecode.lib.hooks import log_pull_action, log_push_action
service = environ['QUERY_STRING'].split('=')
if len(service) < 2:
return
from rhodecode.model.db import Repository
@@ -276,15 +276,15 @@ class SimpleGit(BaseVCSController):
_repo._repo.ui = baseui
push_hook = 'pretxnchangegroup.push_logger'
pull_hook = 'preoutgoing.pull_logger'
_hooks = dict(baseui.configitems('hooks')) or {}
if action == 'push' and _hooks.get(push_hook):
log_push_action(ui=baseui, repo=repo._repo)
log_push_action(ui=baseui, repo=_repo._repo)
elif action == 'pull' and _hooks.get(pull_hook):
log_pull_action(ui=baseui, repo=repo._repo)
log_pull_action(ui=baseui, repo=_repo._repo)
def __inject_extras(self, repo_path, baseui, extras={}):
Injects some extra params into baseui instance
:param baseui: baseui instance
Status change: