changeset 3456:cf1fbc9fed89 beta

Added get_hook_location method for easier hook extraction
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 05 Mar 2013 19:42:08 +0100
parents d5ae996eed11
children 08e8115585bd
files rhodecode/lib/vcs/backends/git/repository.py rhodecode/lib/vcs/backends/hg/repository.py
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/git/repository.py	Tue Mar 05 11:39:30 2013 +0100
+++ b/rhodecode/lib/vcs/backends/git/repository.py	Tue Mar 05 19:42:08 2013 +0100
@@ -306,6 +306,15 @@
             url = ':///'.join(('file', url))
         return url
 
+    def get_hook_location(self):
+        """
+        returns absolute path to location where hooks are stored
+        """
+        loc = os.path.join(self.path, 'hooks')
+        if not self.bare:
+            loc = os.path.join(self.path, '.git', 'hooks')
+        return loc
+
     @LazyProperty
     def name(self):
         return os.path.basename(self.path)
--- a/rhodecode/lib/vcs/backends/hg/repository.py	Tue Mar 05 11:39:30 2013 +0100
+++ b/rhodecode/lib/vcs/backends/hg/repository.py	Tue Mar 05 19:42:08 2013 +0100
@@ -422,6 +422,12 @@
             url = "file:" + urllib.pathname2url(url)
         return url
 
+    def get_hook_location(self):
+        """
+        returns absolute path to location where hooks are stored
+        """
+        return os.path.join(self.path, '.hg', '.hgrc')
+
     def get_changeset(self, revision=None):
         """
         Returns ``MercurialChangeset`` object representing repository's
@@ -492,7 +498,7 @@
         """
         return MercurialWorkdir(self)
 
-    def get_config_value(self, section, name, config_file=None):
+    def get_config_value(self, section, name=None, config_file=None):
         """
         Returns configuration value for a given [``section``] and ``name``.