Improve SVN version parser

SVN has multiple distributions on Windows, e.g. SlikSVN, CollabNet. Some
of them suffix the version with a "-{distro}" part, which causes the
previous implementation to fail.

This patch removes that final part and make the version logic work.
This commit is contained in:
Tzu-ping Chung 2020-07-31 06:38:43 +08:00
parent 31299ee370
commit c3e1a153fd
1 changed files with 3 additions and 1 deletions

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: