--- a/mercurial/hg.py Mon Jan 17 12:50:13 2022 +0100
+++ b/mercurial/hg.py Tue Jan 18 10:27:13 2022 +0100
@@ -10,6 +10,7 @@
import errno
import os
+import posixpath
import shutil
import stat
import weakref
@@ -1285,7 +1286,11 @@
source = bytes(subpath)
else:
p = urlutil.url(source)
- p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
+ if p.islocal():
+ normpath = os.path.normpath
+ else:
+ normpath = posixpath.normpath
+ p.path = normpath(b'%s/%s' % (p.path, subpath))
source = bytes(p)
other = peer(repo, opts, source)
cleanupfn = other.close
@@ -1356,7 +1361,11 @@
dest = bytes(subpath)
else:
p = urlutil.url(dest)
- p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
+ if p.islocal():
+ normpath = os.path.normpath
+ else:
+ normpath = posixpath.normpath
+ p.path = normpath(b'%s/%s' % (p.path, subpath))
dest = bytes(p)
branches = path.branch, opts.get(b'branch') or []