# HG changeset patch # User Felipe Resende # Date 1710633739 10800 # Node ID 08913487ae8038cc16af3df0ecada7fd096732e3 # Parent a2f1d97e5284b60b3a16cb071ccc015f6721bc29 subrepo: fix normalizing paths with scheme After revision 0afe96e374a7, subrepo paths were normalized using posixpath.normpath and that resulted in ssh paths being wrongly converted from ssh://host/path to ssh:/host/path This fix applies the same logic used in urlutil.url to split the path scheme from the rest and only use posixpath.normpath to the string after scheme:// diff -r a2f1d97e5284 -r 08913487ae80 mercurial/subrepoutil.py --- a/mercurial/subrepoutil.py Sat Mar 16 18:37:07 2024 -0300 +++ b/mercurial/subrepoutil.py Sat Mar 16 21:02:19 2024 -0300 @@ -421,7 +421,18 @@ chunks.reverse() path = posixpath.join(*chunks) - return posixpath.normpath(path) + matchscheme = re.compile(b'^[a-zA-Z0-9+.\\-]+:').match + if matchscheme(path): + scheme, path = path.split(b':', 1) + if path.startswith(b'//'): + path = path[2:] + sep = b'//' + else: + sep = b'' + normalized_path = scheme + b':' + sep + posixpath.normpath(path) + else: + normalized_path = posixpath.normpath(path) + return normalized_path def reporelpath(repo: "localrepo.localrepository") -> bytes: