changeset 4205:5b3bbffea092 kallithea-2.2.5-rebrand

Cleanup of git hook installation
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:05:36 -0400
parents bd720d050d68
children 703d3208424c
files kallithea/config/post_receive_tmpl.py kallithea/config/pre_receive_tmpl.py kallithea/model/scm.py
diffstat 3 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/post_receive_tmpl.py	Wed Jul 02 19:05:36 2014 -0400
+++ b/kallithea/config/post_receive_tmpl.py	Wed Jul 02 19:05:36 2014 -0400
@@ -4,8 +4,8 @@
 
 try:
     import kallithea
-    RC_HOOK_VER = '_TMPL_'
-    os.environ['RC_HOOK_VER'] = RC_HOOK_VER
+    KALLITHEA_HOOK_VER = '_TMPL_'
+    os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
     from kallithea.lib.hooks import handle_git_post_receive as _handler
 except ImportError:
     if os.environ.get('RC_DEBUG_GIT_HOOK'):
--- a/kallithea/config/pre_receive_tmpl.py	Wed Jul 02 19:05:36 2014 -0400
+++ b/kallithea/config/pre_receive_tmpl.py	Wed Jul 02 19:05:36 2014 -0400
@@ -4,8 +4,8 @@
 
 try:
     import kallithea
-    RC_HOOK_VER = '_TMPL_'
-    os.environ['RC_HOOK_VER'] = RC_HOOK_VER
+    KALLITHEA_HOOK_VER = '_TMPL_'
+    os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
     from kallithea.lib.hooks import handle_git_pre_receive as _handler
 except ImportError:
     if os.environ.get('RC_DEBUG_GIT_HOOK'):
--- a/kallithea/model/scm.py	Wed Jul 02 19:05:36 2014 -0400
+++ b/kallithea/model/scm.py	Wed Jul 02 19:05:36 2014 -0400
@@ -853,7 +853,7 @@
 
         for h_type, tmpl in [('pre', tmpl_pre), ('post', tmpl_post)]:
             _hook_file = jn(loc, '%s-receive' % h_type)
-            _rhodecode_hook = False
+            has_hook = False
             log.debug('Installing git hook in repo %s' % repo)
             if os.path.exists(_hook_file):
                 # let's take a look at this hook, maybe it's rhodecode ?
@@ -861,19 +861,19 @@
                 with open(_hook_file, 'rb') as f:
                     data = f.read()
                     matches = re.compile(r'(?:%s)\s*=\s*(.*)'
-                                         % 'RC_HOOK_VER').search(data)
+                                         % 'KALLITHEA_HOOK_VER').search(data)
                     if matches:
                         try:
                             ver = matches.groups()[0]
                             log.debug('got %s it is rhodecode' % (ver))
-                            _rhodecode_hook = True
+                            has_hook = True
                         except Exception:
                             log.error(traceback.format_exc())
             else:
                 # there is no hook in this dir, so we want to create one
-                _rhodecode_hook = True
+                has_hook = True
 
-            if _rhodecode_hook or force_create:
+            if has_hook or force_create:
                 log.debug('writing %s hook file !' % (h_type,))
                 try:
                     with open(_hook_file, 'wb') as f: