changeset 47830:981cef5188c3 stable

templater: swap `\` with `/` in more location This is similar to the previous changeset, but apply that logic to _readmapfile. Differential Revision: https://phab.mercurial-scm.org/D11282
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 17 Aug 2021 14:38:25 +0200
parents 7ab7f73a7f0a
children 94158c541c74
files mercurial/templater.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Tue Aug 17 13:22:06 2021 +0200
+++ b/mercurial/templater.py	Tue Aug 17 14:38:25 2021 +0200
@@ -833,6 +833,13 @@
 
 def _readmapfile(fp, mapfile):
     """Load template elements from the given map file"""
+    if pycompat.iswindows:
+        # quick hack to make sure we can process '/' in the code dealing with
+        # ressource. Ideally we would make sure we use `/` instead of `ossep`
+        # in the templater code, but that seems a bigger and less certain
+        # change that we better left for the default branch.
+        name_paths = mapfile.split(pycompat.ossep)
+        mapfile = b'/'.join(name_paths)
     base = os.path.dirname(mapfile)
     conf = config.config()