changeset 2406:7be31af5bc78 beta

changed scope of calling EXTENSIONS from rhodecode for githooks to be able to execute them
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 06 Jun 2012 21:48:53 +0200
parents 5019f7798733
children 8a68e0292232
files rhodecode/lib/hooks.py rhodecode/lib/middleware/pygrack.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/hooks.py	Wed Jun 06 21:32:53 2012 +0200
+++ b/rhodecode/lib/hooks.py	Wed Jun 06 21:48:53 2012 +0200
@@ -30,7 +30,6 @@
 from mercurial.scmutil import revrange
 from mercurial.node import nullrev
 
-from rhodecode import EXTENSIONS
 from rhodecode.lib import helpers as h
 from rhodecode.lib.utils import action_logger
 from rhodecode.lib.vcs.backends.base import EmptyChangeset
@@ -100,6 +99,7 @@
 
     action_logger(username, action, repository, extras['ip'], commit=True)
     # extension hook call
+    from rhodecode import EXTENSIONS
     callback = getattr(EXTENSIONS, 'PULL_HOOK', None)
 
     if isfunction(callback):
@@ -149,6 +149,7 @@
     action_logger(username, action, repository, extras['ip'], commit=True)
 
     # extension hook call
+    from rhodecode import EXTENSIONS
     callback = getattr(EXTENSIONS, 'PUSH_HOOK', None)
     if isfunction(callback):
         kw = {'pushed_revs': revs}
@@ -183,7 +184,7 @@
      'repo_name'
 
     """
-
+    from rhodecode import EXTENSIONS
     callback = getattr(EXTENSIONS, 'CREATE_REPO_HOOK', None)
     if isfunction(callback):
         kw = {}
--- a/rhodecode/lib/middleware/pygrack.py	Wed Jun 06 21:32:53 2012 +0200
+++ b/rhodecode/lib/middleware/pygrack.py	Wed Jun 06 21:48:53 2012 +0200
@@ -127,7 +127,8 @@
             # env and connect to db
             gitenv['RHODECODE_CONFIG_FILE'] = CONFIG['__file__']
             opts = dict(
-                env=gitenv
+                env=gitenv,
+                cwd=os.getcwd()
             )
             out = subprocessio.SubprocessIOChunker(
                 r'git %s --stateless-rpc "%s"' % (git_command[4:],