[damned-lies] Fixed SVN checkout path



commit 502c4e441e8cf142ba153f397ab8ee907a1cf149
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Sep 19 08:55:14 2019 +0200

    Fixed SVN checkout path

 stats/repos.py       | 11 ++++++++---
 stats/tests/tests.py |  5 +++--
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/stats/repos.py b/stats/repos.py
index fc27d450..28de2682 100644
--- a/stats/repos.py
+++ b/stats/repos.py
@@ -2,7 +2,7 @@ import os
 import shutil
 
 from common.utils import run_shell_command
-from stats.utils import STATUS_OK
+from stats.utils import STATUS_OK, url_join
 
 
 class RepoBase:
@@ -126,9 +126,14 @@ class GitRepo(RepoBase):
 
 class SVNRepo(RepoBase):
     def init_checkout(self):
+        root = self.branch.module.vcs_root
+        if self.branch.is_head():
+            co_url = url_join(root, self.branch.module.name, "trunk")
+        else:
+            co_url = url_join(root, self.branch.module.name, "branches", self.branch.name)
+
         run_shell_command([
-            'svn', 'co', '--non-interactive',
-            self.branch.module.vcs_root, str(self.branch.co_path)
+            'svn', 'co', '--non-interactive', co_url, str(self.branch.co_path)
         ], raise_on_error=True)
 
     def update(self):
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index f95e83fc..05340064 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -923,11 +923,12 @@ class OtherTests(TestCase):
     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'
+            name='webkit', vcs_type='svn', vcs_root='https://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 %s/svn/webkit.HEAD' % 
settings.SCRATCHDIR
+            'svn co --non-interactive https://svn.webkit.org/repository/webkit/trunk '
+            '%s/svn/webkit.HEAD' % settings.SCRATCHDIR
         ])


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