diff -r 0428978bca22 -r 9628d3cd9d13 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sat Oct 10 12:43:04 2020 +0530 +++ b/mercurial/cmdutil.py Wed Oct 14 14:43:39 2020 -0700 @@ -558,7 +558,7 @@ # backup continues for f in tobackup: fd, tmpname = pycompat.mkstemp( - prefix=f.replace(b'/', b'_') + b'.', dir=backupdir + prefix=os.path.basename(f) + b'.', dir=backupdir ) os.close(fd) ui.debug(b'backup %r as %r\n' % (f, tmpname))