# HG changeset patch # User Mads Kiilerich # Date 2020-01-25 16:42:40 # Node ID 42ef4ea26efa7bc990d9bbce7d9597d53d82afd0 # Parent 8f468d08f463e8f6c98c8129dd64e71db3c9bffd vcs: drop unused get_hook_location (Issue #353) Also, the hg implementation was odd - the '.hgrc' directory name looks very similar to 'hgrc' but could be anything, such as 'hooks'. diff --git a/kallithea/lib/vcs/backends/git/repository.py b/kallithea/lib/vcs/backends/git/repository.py --- a/kallithea/lib/vcs/backends/git/repository.py +++ b/kallithea/lib/vcs/backends/git/repository.py @@ -321,15 +321,6 @@ 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/kallithea/lib/vcs/backends/hg/repository.py b/kallithea/lib/vcs/backends/hg/repository.py --- a/kallithea/lib/vcs/backends/hg/repository.py +++ b/kallithea/lib/vcs/backends/hg/repository.py @@ -492,12 +492,6 @@ 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 diff --git a/kallithea/tests/vcs/test_git.py b/kallithea/tests/vcs/test_git.py --- a/kallithea/tests/vcs/test_git.py +++ b/kallithea/tests/vcs/test_git.py @@ -780,9 +780,11 @@ class TestGitHooks(object): self.repo = GitRepository(self.repo_directory, create=True) # Create a dictionary where keys are hook names, and values are paths to - # them. Deduplicates code in tests a bit. - self.hook_directory = self.repo.get_hook_location() - self.kallithea_hooks = dict((h, os.path.join(self.hook_directory, h)) for h in ("pre-receive", "post-receive")) + # them in the non-bare repo. Deduplicates code in tests a bit. + self.kallithea_hooks = { + "pre-receive": os.path.join(self.repo.path, '.git', 'hooks', "pre-receive"), + "post-receive": os.path.join(self.repo.path, '.git', 'hooks', "post-receive"), + } def test_hooks_created_if_missing(self): """