Merge pull request #8665 from uranusjr/svn-version-more-robust

Improve SVN version parser
This commit is contained in:
Stéphane Bidoul 2020-08-01 14:13:54 +02:00 committed by Pradyun Gedam
parent 864e2eee09
commit 22d67dc261
No known key found for this signature in database
GPG Key ID: FF99710C4332258E
3 changed files with 7 additions and 1 deletions

1
news/8665.bugfix Normal file
View File

@ -0,0 +1 @@
Fix SVN version detection for alternative SVN distributions.

View File

@ -213,6 +213,8 @@ class Subversion(VersionControl):
# compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0
# svn, version 1.7.14 (r1542130)
# compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu
# svn, version 1.12.0-SlikSvn (SlikSvn/1.12.0)
# compiled May 28 2019, 13:44:56 on x86_64-microsoft-windows6.2
version_prefix = 'svn, version '
version = self.run_command(['--version'])
@ -220,7 +222,7 @@ class Subversion(VersionControl):
return ()
version = version[len(version_prefix):].split()[0]
version_list = version.split('.')
version_list = version.partition('-')[0].split('.')
try:
parsed_version = tuple(map(int, version_list))
except ValueError:

View File

@ -443,6 +443,9 @@ def test_subversion__call_vcs_version():
('svn, version 1.10.3 (r1842928)\n'
' compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0',
(1, 10, 3)),
('svn, version 1.12.0-SlikSvn (SlikSvn/1.12.0)\n'
' compiled May 28 2019, 13:44:56 on x86_64-microsoft-windows6.2',
(1, 12, 0)),
('svn, version 1.9.7 (r1800392)', (1, 9, 7)),
('svn, version 1.9.7a1 (r1800392)', ()),
('svn, version 1.9 (r1800392)', (1, 9)),