incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [1/12] git commit: [#5076] Removed _copy_hooks from ForgeSVN (moved to ForgeClassic)
Date Thu, 25 Oct 2012 22:30:01 GMT
Updated Branches:
  refs/heads/cj/5076 57e7f73e0 -> 088db420b (forced update)


[#5076] Removed _copy_hooks from ForgeSVN (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/088db420
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/088db420
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/088db420

Branch: refs/heads/cj/5076
Commit: 088db420b0b85fc08908dc4f1f9bd97b42f8e14f
Parents: 077bbf6
Author: Cory Johns <johnsca@geek.net>
Authored: Thu Oct 25 22:29:34 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Thu Oct 25 22:29:34 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/088db420/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 96bbc9b..22fe0e6 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -433,44 +433,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/088db420/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 1ea425f..99ad6e9 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -154,31 +154,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()


Mime
View raw message