helper: adjust for hg 6.1

mercurial.util.url became mercurial.utils.urlutil.url in 5.8.
This commit is contained in:
Julien Cristau
2022-03-27 16:50:39 +02:00
committed by Mark Nauwelaerts
parent ebd5bdb111
commit dfa3ad5fca

View File

@@ -5,6 +5,11 @@
from mercurial import hg, ui, commands, util
from mercurial import context, subrepo
try:
# hg >= 5.8
from mercurial.utils import urlutil
except ImportError:
from mercurial import util as urlutil
import re
import sys
@@ -308,11 +313,11 @@ class GitHgRepo:
if not kind in (b'hg', b'git'):
warn('skipping unsupported subrepo type %s' % kind)
continue
if not util.url(src).isabs():
if not urlutil.url(src).isabs():
parent = self.get_hg_repo_url(remote)
if not parent:
die(b'could not determine repo url of %s' % remote)
parent = util.url(parent)
parent = urlutil.url(parent)
parent.path = posixpath.join(parent.path or b'', src)
parent.path = posixpath.normpath(parent.path)
src = bytes(parent)