You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/10/30 21:17:41 UTC

[3/7] git commit: [#5076] Removed _copy_hooks from ForgeSVN (moved to ForgeClassic)

[#5076] Removed _copy_hooks from ForgeSVN (moved to ForgeClassic)

Signed-off-by: Cory Johns <jo...@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/dc2fa02a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/dc2fa02a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/dc2fa02a

Branch: refs/heads/master
Commit: dc2fa02a2316ac287af8c9dacc200c5cd5cf8691
Parents: 0d96d93
Author: Cory Johns <jo...@geek.net>
Authored: Thu Oct 25 22:29:34 2012 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Mon Oct 29 20:08:20 2012 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/model/svn.py                   |   36 -----------------
 ForgeSVN/forgesvn/tests/model/test_repository.py |   28 +-----------
 2 files changed, 3 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dc2fa02a/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 175b420..aabdc3e 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -434,44 +434,8 @@ class SVNImplementation(M.RepositoryImplementation):
 
         return size
 
-    def _process_classic_user_hooks(self, file_name):
-        target_file = os.path.join(self._repo.full_fs_path, 'hooks/post-commit-user')
-        with open(file_name) as classic:
-            with open(target_file, 'w') as allura:
-                allura.write('#!/bin/bash\n')
-                for line in classic:
-                    if not line.startswith('/var/local'):
-                        continue
-                    if re.search(r'sf-svn-stats-hook.py|keepsake', line):
-                        continue
-                    line = re.sub(r'/sfp-svn/', '/sfu-scm/', line)
-                    line = re.sub(r'--viewcvs-url "[^"]*"', '--viewcvs-url "%s%s%%s"' % (
-                        tg.config.get('base_url', ''), self._repo.url()), line)
-                    line = re.sub(r'--revisionURI="[^"]*"', '--revisionURI="%s%s%%(revision)s"' % (
-                        tg.config.get('base_url', ''), self._repo.url()), line)
-                    line = re.sub(r'--repositoryURI=\S*', '--repositoryURI=%s' % self._repo.clone_url('https_anon'), line)
-                    allura.write(line)
-        shutil.copymode(file_name, target_file)
-
-    def _copy_hooks(self, source_path):
-        '''Copy existing hooks if source path is given and exists.'''
-        if source_path is not None and source_path.startswith('file://'):
-            source_path = source_path[7:]
-        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-commit':
-                self._process_classic_user_hooks(hook)
-            else:
-                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 post-commit and pre-revprop-change hooks'
-        if copy_hooks:
-            self._copy_hooks(source_path)
         # setup a post-commit hook to notify Allura of changes to the repo
         # the hook should also call the user-defined post-commit-user hook
         text = self.post_receive_template.substitute(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dc2fa02a/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index 6a14843..a2d8e68 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -162,31 +162,9 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         assert os.path.exists('/tmp/testsvn/hooks/pre-revprop-change')
         assert os.access('/tmp/testsvn/hooks/pre-revprop-change', os.X_OK)
         with open('/tmp/testsvn/hooks/pre-revprop-change') as f: c = f.read()
-        self.assertEqual(c, 'pre-revprop-change\n')
-        assert os.path.exists('/tmp/testsvn/hooks/post-revprop-change')
-        assert os.access('/tmp/testsvn/hooks/post-revprop-change', os.X_OK)
-        with open('/tmp/testsvn/hooks/post-revprop-change') as f: c = f.read()
-        self.assertEqual(c, 'post-revprop-change\n')
-        assert os.path.exists('/tmp/testsvn/hooks/post-commit-user')
-        assert os.access('/tmp/testsvn/hooks/post-commit-user', os.X_OK)
-        with open('/tmp/testsvn/hooks/post-commit-user') as f: c = f.read()
-        expected = (
-                    '#!/bin/bash\n'
-                    '/var/local/mastertree/host/sfu-scm/hook-scripts/ciabot_svn.py --revisionURI="http://localhost//p/test/src/%(revision)s" --repositoryURI=https://localhost:8022/scm-repo/test/testsvn/ "$1" "$2" t2809\n'
-                    '/var/local/mastertree/host/sfu-scm/hook-scripts/ciabot_svn.py --revisionURI="http://localhost//p/test/src/%(revision)s" --repositoryURI=https://localhost:8022/scm-repo/test/testsvn/ "$1" "$2" "foo"\n'
-                    '/var/local/mastertree/host/sfu-scm/hook-scripts/svnnotify --repos-path "$1" --revision "$2" --to "test@example.com" --subject-prefix "SF.net SVN: t2809:" --subject-cx --no-first-line --with-diff --viewcvs-url "http://localhost//p/test/src/%s" --user-domain "users.sourceforge.net" --footer "This was sent by the SourceForge.net collaborative development platform, the world\'s largest Open Source development site." -l /usr/bin/svnlook --max-diff-length 100000\n'
-                    '/var/local/mastertree/host/sfu-scm/hook-scripts/svnnotify --repos-path "$1" --revision "$2" --to "test@example.com" --subject-prefix "SF.net SVN: t2809:" --subject-cx --no-first-line --viewcvs-url "http://localhost//p/test/src/%s" --user-domain "users.sourceforge.net" --footer "This was sent by the SourceForge.net collaborative development platform, the world\'s largest Open Source development site." -l /usr/bin/svnlook --max-diff-length 100000\n'
-                )
-        self.assertEqual(c, expected, (
-                    'Incorrect post-commit-user; expected:\n'
-                    '-------------------------------------\n'
-                    '%s'
-                    '-------------------------------------\n'
-                    'Got:\n'
-                    '-------------------------------------\n'
-                    '%s'
-                    '-------------------------------------\n'
-                ) % (expected, c))
+        self.assertEqual(c, '#!/bin/sh\n')
+        assert not os.path.exists('/tmp/testsvn/hooks/post-revprop-change')
+        assert not os.path.exists('/tmp/testsvn/hooks/post-commit-user')
         assert os.path.exists('/tmp/testsvn/hooks/post-commit')
         assert os.access('/tmp/testsvn/hooks/post-commit', os.X_OK)
         with open('/tmp/testsvn/hooks/post-commit') as f: c = f.read()