# HG changeset patch # User Marcin Kuzminski # Date 2013-03-05 18:42:08 # Node ID cf1fbc9fed89475631df3236c0a6ed2b2ac2e2e1 # Parent d5ae996eed11a4df559c7f9f9e91feb5515e5887 Added get_hook_location method for easier hook extraction diff --git a/rhodecode/lib/vcs/backends/git/repository.py b/rhodecode/lib/vcs/backends/git/repository.py --- a/rhodecode/lib/vcs/backends/git/repository.py +++ b/rhodecode/lib/vcs/backends/git/repository.py @@ -306,6 +306,15 @@ class GitRepository(BaseRepository): 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) diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -422,6 +422,12 @@ class MercurialRepository(BaseRepository 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 @@ class MercurialRepository(BaseRepository """ 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``.