From 02ea87e3d9940e173cf43458cb520a54e552332e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 7 Apr 2022 09:07:08 -0600 Subject: [PATCH 1/3] Fix svn URLs on Windows Resolves ESMCI/manage_externals#166 --- manic/repository_svn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manic/repository_svn.py b/manic/repository_svn.py index 408ed84676..fea5c10feb 100644 --- a/manic/repository_svn.py +++ b/manic/repository_svn.py @@ -44,9 +44,9 @@ def __init__(self, component_name, repo, ignore_ancestry=False): Repository.__init__(self, component_name, repo) self._ignore_ancestry = ignore_ancestry if self._branch: - self._url = os.path.join(self._url, self._branch) + self._url = self._url + '/' + self._branch elif self._tag: - self._url = os.path.join(self._url, self._tag) + self._url = self._url + '/' + self._tag else: msg = "DEV_ERROR in svn repository. Shouldn't be here!" fatal_error(msg) From eb7fc1368fa34dbbac856e7ed3e1d89fde066d17 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 7 Apr 2022 09:21:18 -0600 Subject: [PATCH 2/3] Handle the possibility that the URL already ends with '/' From some testing, I don't think it's essential that we avoid a double slash, but this is needed for unit tests to pass, and leads to cleaner URLs. --- manic/repository_svn.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/manic/repository_svn.py b/manic/repository_svn.py index fea5c10feb..922855d34e 100644 --- a/manic/repository_svn.py +++ b/manic/repository_svn.py @@ -43,10 +43,15 @@ def __init__(self, component_name, repo, ignore_ancestry=False): """ Repository.__init__(self, component_name, repo) self._ignore_ancestry = ignore_ancestry + if self._url.endswith('/'): + # there is already a '/' separator in the URL; no need to add another + url_sep = '' + else: + url_sep = '/' if self._branch: - self._url = self._url + '/' + self._branch + self._url = self._url + url_sep + self._branch elif self._tag: - self._url = self._url + '/' + self._tag + self._url = self._url + url_sep + self._tag else: msg = "DEV_ERROR in svn repository. Shouldn't be here!" fatal_error(msg) From 3510da848c84fac46876bd727b6a1b7986bfd025 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 7 Apr 2022 09:30:44 -0600 Subject: [PATCH 3/3] Tweak a unit test to improve coverage Now both branches of the self._url.endswith conditional block from the last commit are covered: test_check_url_same now covers the branch where the URL does *not* already end with '/', and test_repo_dir_synced appears to still cover the branch where the URL *does* already end with '/' (based on seeing that that unit test still fails if that branch is wrong). --- test/test_unit_repository_svn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 test/test_unit_repository_svn.py diff --git a/test/test_unit_repository_svn.py b/test/test_unit_repository_svn.py old mode 100644 new mode 100755 index 41b173bf3d..d9309df7f6 --- a/test/test_unit_repository_svn.py +++ b/test/test_unit_repository_svn.py @@ -60,7 +60,7 @@ def setUp(self): self._name = 'component' rdata = {ExternalsDescription.PROTOCOL: 'svn', ExternalsDescription.REPO_URL: - 'https://svn-ccsm-models.cgd.ucar.edu/', + 'https://svn-ccsm-models.cgd.ucar.edu', ExternalsDescription.TAG: 'mosart/trunk_tags/mosart1_0_26', }