diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -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 []