Changeset - 42ef4ea26efa
[Not reviewed]
default
0 3 0
Mads Kiilerich - 6 years ago 2020-01-25 16:42:40
mads@kiilerich.com
Grafted from: 42d725799780
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'.
3 files changed with 5 insertions and 18 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -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)
kallithea/lib/vcs/backends/hg/repository.py
Show inline comments
 
@@ -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
kallithea/tests/vcs/test_git.py
Show inline comments
 
@@ -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):
 
        """
0 comments (0 inline, 0 general)