incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [3/25] git commit: [#5076] Removed _copy_hooks from ForgeGit (moved to ForgeClassic)
Date Mon, 29 Oct 2012 20:10:46 GMT
[#5076] Removed _copy_hooks from ForgeGit (moved to ForgeClassic)

Signed-off-by: Cory Johns <johnsca@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3c462c70
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3c462c70
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3c462c70

Branch: refs/heads/cj/5076
Commit: 3c462c708a41fa8c0015f960f0afbc8e70c51bab
Parents: db4407b
Author: Cory Johns <johnsca@geek.net>
Authored: Thu Oct 25 18:02:30 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Oct 29 20:08:19 2012 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py              |   14 --------------
 ForgeGit/forgegit/tests/model/test_repository.py |   10 ++--------
 2 files changed, 2 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3c462c70/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 68887af..416b931 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -260,22 +260,8 @@ class GitImplementation(M.RepositoryImplementation):
     def blob_size(self, blob):
         return self._object(blob._id).data_stream.size
 
-    def _copy_hooks(self, source_path):
-        '''Copy existing hooks if source path is given and exists.'''
-        if source_path is None or not os.path.exists(source_path):
-            return
-        for hook in glob(os.path.join(source_path, 'hooks/*')):
-            filename = os.path.basename(hook)
-            target_filename = filename
-            if filename == 'post-receive':
-                target_filename = 'post-receive-user'
-            target = os.path.join(self._repo.full_fs_path, 'hooks', target_filename)
-            shutil.copy2(hook, target)
-
     def _setup_hooks(self, source_path=None, copy_hooks=False):
         'Set up the git post-commit hook'
-        if copy_hooks:
-            self._copy_hooks(source_path)
         text = self.post_receive_template.substitute(
             url=tg.config.get('base_url', 'http://localhost:8080')
             + '/auth/refresh_repo' + self._repo.url())

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3c462c70/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 910391d..c82d4fd 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -163,14 +163,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         repo.init()
         repo._impl.clone_from(repo_path, copy_hooks=True)
         assert len(repo.log())
-        assert os.path.exists('/tmp/testgit.git/hooks/update')
-        assert os.access('/tmp/testgit.git/hooks/update', os.X_OK)
-        with open('/tmp/testgit.git/hooks/update') as f: c = f.read()
-        self.assertEqual(c, 'update\n')
-        assert os.path.exists('/tmp/testgit.git/hooks/post-receive-user')
-        assert os.access('/tmp/testgit.git/hooks/post-receive-user', os.X_OK)
-        with open('/tmp/testgit.git/hooks/post-receive-user') as f: c = f.read()
-        self.assertEqual(c, 'post-receive\n')
+        assert not os.path.exists('/tmp/testgit.git/hooks/update')
+        assert not os.path.exists('/tmp/testgit.git/hooks/post-receive-user')
         assert os.path.exists('/tmp/testgit.git/hooks/post-receive')
         assert os.access('/tmp/testgit.git/hooks/post-receive', os.X_OK)
         with open('/tmp/testgit.git/hooks/post-receive') as f: c = f.read()


Mime
View raw message