@@ -59,15 +59,24 @@ function HgAdapter.run_bootstrap()
5959 end
6060
6161 local out = utils .job (utils .flatten ({ hg_cmd , " version" }))
62- local version = out [1 ] and out [1 ]:match (" Mercurial .*%(version (%S*)%)" ) or nil
62+ local line = out [1 ]
63+ local is_sapling = line and line :match (" ^Sapling" ) ~= nil
64+ local version = is_sapling and line :match (" Sapling (%S+)" )
65+ or (line and line :match (" Mercurial .*%(version (%S*)%)" ))
66+ or nil
6367 if not version then
64- return err (" Could not get Mercurial version!" )
68+ return err (" Could not get Mercurial/Sapling version!" )
6569 end
6670
6771 -- Parse version string
68- local major , minor , patch = version :match (" (%d+)%.?(%d*)%.?(%d*)" )
72+ local base_version = version :match (" ^([%d%.]+)" )
73+ if not base_version then
74+ return err (fmt (" Could not parse Mercurial/Sapling version: %s!" , version ))
75+ end
76+
77+ local major , minor , patch = base_version :match (" (%d+)%.?(%d*)%.?(%d*)" )
6978 if not major then
70- return err (string.format (" Could not parse Mercurial version: %s!" , version ))
79+ return err (fmt (" Could not parse Mercurial/Sapling version: %s!" , version ))
7180 end
7281
7382 local v , target = bs .version , bs .target_version
@@ -78,7 +87,9 @@ function HgAdapter.run_bootstrap()
7887 bs .version_string = version
7988 bs .target_version_string = fmt (" %d.%d.%d" , target .major , target .minor , target .patch )
8089
81- local version_ok = vcs_utils .check_semver (v , target )
90+ -- Skip version check for Sapling
91+ local version_ok = is_sapling or vcs_utils .check_semver (v , target )
92+
8293 if not version_ok then
8394 return err (string.format (
8495 " Mercurial version is outdated! Some functionality might not work as expected, "
0 commit comments