incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/50] git commit: [#3027] ticket:165 fixed import
Date Wed, 19 Sep 2012 18:43:27 GMT
[#3027] ticket:165 fixed import


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

Branch: refs/heads/master
Commit: 40bc8ac9bc9f88e415937eb60e06f88657b03c5a
Parents: c4ef0bc
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Fri Sep 14 15:37:31 2012 +0400
Committer: Cory Johns <johnsca@geek.net>
Committed: Tue Sep 18 22:07:06 2012 +0000

----------------------------------------------------------------------
 Allura/allura/lib/utils.py                       |    2 +-
 ForgeSVN/forgesvn/model/svn.py                   |    7 +++++--
 ForgeSVN/forgesvn/svn_main.py                    |    6 +++---
 ForgeSVN/forgesvn/tests/model/test_repository.py |    9 +++++++++
 4 files changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/40bc8ac9/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index 9d70415..5ea7015 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -430,7 +430,7 @@ def generate_code_stats(blob):
     stats['data_line_count'] = sum([1 for l in lines if not spaces.match(l)])
     return stats
 
-def check_svn_repo(path):
+def svn_path_exists(path):
     svn = pysvn.Client()
     try:
         svn.info2(path)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/40bc8ac9/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 4930c55..0037bd0 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -25,7 +25,7 @@ from allura import model as M
 from allura.lib import helpers as h
 from allura.model.repository import GitLikeTree
 from allura.model.auth import User
-from allura.lib.utils import check_svn_repo
+from allura.lib.utils import svn_path_exists
 
 log = logging.getLogger(__name__)
 
@@ -162,7 +162,10 @@ class SVNImplementation(M.RepositoryImplementation):
         check_call(['svnsync', 'init', self._url, source_url])
         check_call(['svnsync', '--non-interactive', 'sync', self._url])
         log.info('... %r cloned', self._repo)
-        if not check_svn_repo(self._repo.fs_path+self._repo.name):
+        if not svn_path_exists("file://%s%s/%s" %
+                         (self._repo.fs_path,
+                          self._repo.name,
+                          c.app.config.options['checkout_url'])):
             c.app.config.options['checkout_url'] = ""
         self._repo.refresh(notify=False)
         self._setup_special_files()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/40bc8ac9/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index c06dc6e..1cc54d3 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -17,7 +17,7 @@ from allura.lib.repository import RepositoryApp, RepoAdminController
 from allura.app import SitemapEntry, ConfigOption
 from allura.lib import helpers as h
 from allura import model as M
-from allura.lib.utils import check_svn_repo
+from allura.lib.utils import svn_path_exists
 
 # Local imports
 from . import model as SM
@@ -99,14 +99,14 @@ class SVNRepoAdminController(RepoAdminController):
     @expose()
     @require_post()
     def set_checkout_url(self, **post_data):
-        if check_svn_repo("file://%s%s/%s" %
+        if svn_path_exists("file://%s%s/%s" %
                           (self.app.repo.fs_path,
                            self.app.repo.name,
                            post_data['checkout_url'])):
             self.app.config.options['checkout_url'] = post_data['checkout_url']
             flash("Checkout URL successfully changed")
         else:
-            flash("%s isn't a valid svn repository" % post_data['checkout_url'], "error")
+            flash("%s is not a valid path for this repository" % post_data['checkout_url'],
"error")
 
 
 class SVNImportController(BaseController):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/40bc8ac9/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 d34a50d..e4d84c6 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -7,6 +7,7 @@ from ming.orm import ThreadLocalORMSession
 
 from alluratest.controller import setup_basic_test, setup_global_objects
 from allura.lib import helpers as h
+from allura.lib.utils import svn_path_exists
 from allura.tests import decorators as td
 from allura.tests.model.test_repo import RepoImplTestBase
 from allura import model as M
@@ -179,6 +180,14 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         assert entry.committed.name == 'rick446'
         assert entry.message
 
+    def test_svn_path_exists(self):
+        repo_path = pkg_resources.resource_filename(
+            'forgesvn', 'tests/data/testsvn')
+        assert svn_path_exists("file://%s/a" % repo_path)
+        assert svn_path_exists("file://%s" % repo_path)
+        assert not svn_path_exists("file://%s/badpath" % repo_path)
+
+
 class TestSVNRev(unittest.TestCase):
 
     def setUp(self):


Mime
View raw message