Mercurial > kallithea
changeset 8143:42ef4ea26efa
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'.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sat, 25 Jan 2020 16:42:40 +0100 |
parents | 8f468d08f463 |
children | fa421677f97d |
files | kallithea/lib/vcs/backends/git/repository.py kallithea/lib/vcs/backends/hg/repository.py kallithea/tests/vcs/test_git.py |
diffstat | 3 files changed, 5 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/git/repository.py Wed Jan 22 23:46:12 2020 +0100 +++ b/kallithea/lib/vcs/backends/git/repository.py Sat Jan 25 16:42:40 2020 +0100 @@ -321,15 +321,6 @@ 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/kallithea/lib/vcs/backends/hg/repository.py Wed Jan 22 23:46:12 2020 +0100 +++ b/kallithea/lib/vcs/backends/hg/repository.py Sat Jan 25 16:42:40 2020 +0100 @@ -492,12 +492,6 @@ 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
--- a/kallithea/tests/vcs/test_git.py Wed Jan 22 23:46:12 2020 +0100 +++ b/kallithea/tests/vcs/test_git.py Sat Jan 25 16:42:40 2020 +0100 @@ -780,9 +780,11 @@ 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): """