[apycotlib] remove support for SVN repositories
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 23 Dec 2014 14:25:53 +0100
changeset 1677 998cd9f5cbed
parent 1676 8f156ee8d9e7
child 1678 a8afe91a4ec2
[apycotlib] remove support for SVN repositories Closes #4786982
_apycotlib/repositories.py
test/unittest_repositories.py
test/unittest_task.py
--- a/_apycotlib/repositories.py	Tue Oct 21 23:15:12 2014 +0200
+++ b/_apycotlib/repositories.py	Tue Dec 23 14:25:53 2014 +0100
@@ -99,49 +99,6 @@
         return None
 
 
-def _get_latest_part(string):
-    parts = string.rstrip('/').rsplit('/', 1)
-    if len(parts) > 1:
-        return parts[1]
-    return parts[0]
-
-
-class SVNRepository(VersionedRepository):
-    """extract sources/information for a project from a SVN repository"""
-    id = 'subversion'
-
-    def _ref_repo(self):
-        return self.repository['source_url']
-
-    def _co_path(self):
-        """return the path where the project will be located in the test
-        environment
-        """
-        # only url components
-        if self.branch:
-            return _get_latest_part(self.branch)
-        if self.path:
-            return _get_latest_part(self.path)
-        return self.ref_repo.rstrip('/').rsplit('/', 1)[1]
-
-    def co_command(self, quiet=True):
-        """return a command that may be given to os.system to check out a given
-        package
-        """
-        if quiet:
-            quiet = '-q'
-        else:
-            quiet = ''
-        repository = self.ref_repo
-        if self.branch:
-            repository += '/%s' % self.branch
-        if self.path:
-            repository += '/%s' % self.path
-        return 'svn checkout --non-interactive %s %s' % (quiet, repository)
-
-register('repository', SVNRepository)
-
-
 class HGRepository(VersionedRepository):
     """extract sources/information for a project from a Mercurial repository"""
     id = 'mercurial'
--- a/test/unittest_repositories.py	Tue Oct 21 23:15:12 2014 +0200
+++ b/test/unittest_repositories.py	Tue Dec 23 14:25:53 2014 +0100
@@ -22,40 +22,7 @@
         vcsfile = VCSFile('mercurial', source_url='http://www.labas.org')
         repo = get_repository({'repository': vcsfile, 'path': 'toto'})
         self.assert_(isinstance(repo, HGRepository))
-        vcsfile = VCSFile('subversion', source_url='file://toto')
-        repo = get_repository({'repository': vcsfile})
-        self.assert_(isinstance(repo, SVNRepository))
 
-class SVNRepositoryTC(testlib.TestCase):
-    _tested_class = SVNRepository
-    name = 'subversion'
-
-    def test_co_command(self):
-        vcsfile = VCSFile('subversion', source_url='file://test')
-        repo_def = {'repository':vcsfile, 'path': 'path'}
-        repo = SVNRepository(repo_def)
-        self.assertEqual(repo_def, {})
-        self.assertEqual(repo.co_command(),
-                          'svn checkout --non-interactive -q file://test/path')
-        repo_def = {'repository': vcsfile, 'path': 'path', 'branch':'branch'}
-        repo = SVNRepository(repo_def)
-        self.assertEqual(repo_def, {})
-        self.assertEqual(repo.co_command(),
-                          'svn checkout --non-interactive -q file://test/branch/path')
-
-    def test_co_path(self):
-        vcsfile = VCSFile('subversion', source_url='http://test.logilab.org/svn')
-        repo = SVNRepository({'repository':vcsfile, 'path':'toto/path'})
-        self.assertEqual(repo.co_path, 'path')
-
-    def test_specials(self):
-        vcsfile = VCSFile('subversion', source_url='test')
-        repo = SVNRepository({'repository':vcsfile, 'path': 'toto/path'})
-        self.assertEqual(repr(repo), 'subversion:test/toto/path')
-        self.assert_(repo == copy(repo))
-        vcsfile = VCSFile('subversion', source_url='test')
-        repo2 = SVNRepository({'repository':vcsfile, 'path': 'tutu/path'})
-        self.assert_(not repo == repo2)
 
 class HGRepositoryTC(testlib.TestCase):
     def test_co_path(self):
--- a/test/unittest_task.py	Tue Oct 21 23:15:12 2014 +0200
+++ b/test/unittest_task.py	Tue Dec 23 14:25:53 2014 +0100
@@ -15,28 +15,18 @@
 from apycotlib import SetupException
 from apycotlib import SUCCESS, FAILURE, PARTIAL, SKIPPED
 from apycotlib.atest import Test as BaseTest
-from apycotlib.repositories import SVNRepository
 
 from unittest_checkers import input_path
 # manage temporary repo
 def setUpModule():
-    for repo in ('badpkg2_svn', 'goodpkg_svn'):
-        path = input_path(repo)
-        if exists(path):
-            shutil.rmtree(path)
-        tarfile.open(input_path('%s.tar.gz' % repo), 'r|gz').extractall(input_path(''))
     os.environ['APYCOT_ROOT'] = ''
     mockvcsfile = MockVCSFile('subversion', path='/home/cvs')
-    global MOCKREPO, BADREPO, SVNREPO1, SVNREPO2, TPP
+    global MOCKREPO, BADREPO, TPP
     MOCKREPO = MockRepository(repository=mockvcsfile,
                               path='soft/goodpkg',
                               command='cp -R %s .' % input_path('goodpkg'))
     BADREPO = MockRepository(repository=mockvcsfile,
                              path='soft/goodpkg', command='false')
-    SVNREPO1 = SVNRepository({'repository': MockVCSFile('subversion',
-                                                        source_url='file://%s' % input_path('goodpkg'))})
-    SVNREPO2 = SVNRepository({'repository': MockVCSFile('subversion',
-                                                        source_url='file://%s' % input_path('badpkg2'))})
     TPP = TouchTestPreprocessor()