Patchwork D11282: templater: swap `\` with `/` in more location

login
register
mail settings
Submitter phabricator
Date Aug. 17, 2021, 7 p.m.
Message ID <differential-rev-PHID-DREV-xkmv2biag7ymnvwn7jzd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49596/
State Superseded
Headers show

Comments

phabricator - Aug. 17, 2021, 7 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is similar to the previous changeset, but apply that logic to
  _readmapfile.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11282

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -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()