[damned-lies] Fix SVNRepo.init_checkout



commit 6e891a41fed14e0c410e7547be8a5254617f587c
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri Apr 26 21:49:04 2019 +0200

    Fix SVNRepo.init_checkout
    
    Thanks Pino Toscano for the initial patch.

 stats/repos.py       |  4 ++--
 stats/tests/tests.py | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/stats/repos.py b/stats/repos.py
index c35d44b2..fc27d450 100644
--- a/stats/repos.py
+++ b/stats/repos.py
@@ -128,8 +128,8 @@ class SVNRepo(RepoBase):
     def init_checkout(self):
         run_shell_command([
             'svn', 'co', '--non-interactive',
-            self.branch.get_vcs_url(), self.branch.module.name + "." + self.branch.name
-        ])
+            self.branch.module.vcs_root, str(self.branch.co_path)
+        ], raise_on_error=True)
 
     def update(self):
         run_shell_command(['svn', 'up', '--non-interactive'], raise_on_error=True, cwd=self.branch.co_path)
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index eaf8c70f..e3fedf41 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -893,3 +893,15 @@ class OtherTests(TestCase):
         response = self.client.get(reverse('releases', args=['json']))
         content = json.loads(response.content.decode('utf-8'))
         self.assertEqual(content[0]["fields"]["name"], "gnome-3-18")
+
+    def test_svn_checkout_cmd(self):
+        from ..repos import SVNRepo
+        mod = Module.objects.create(
+            name='webkit', vcs_type='svn', vcs_root='http://svn.webkit.org/repository'
+        )
+        repo = SVNRepo(Branch(name='HEAD', module=mod, vcs_subpath='trunk'))
+        with patch_shell_command() as cmds:
+            repo.init_checkout()
+        self.assertEqual(cmds, [
+            'svn co --non-interactive http://svn.webkit.org/repository %ssvn/webkit.HEAD' % 
settings.SCRATCHDIR
+        ])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]