[Updated] D8896: templater: try to read %include in mapfiles from resources

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Aug 6 00:49:25 UTC 2020


Closed by commit rHGfef64d7a4a84: templater: try to read %include in mapfiles from resources (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8896?vs=22278&id=22294

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8896/new/

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

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -835,11 +835,17 @@
             if os.path.isfile(abs):
                 subresource = util.posixfile(abs, b'rb')
         if not subresource:
-            dir = templatedir()
-            if dir:
-                abs = os.path.normpath(os.path.join(dir, rel))
-                if os.path.isfile(abs):
-                    subresource = util.posixfile(abs, b'rb')
+            if pycompat.ossep not in rel:
+                abs = rel
+                subresource = resourceutil.open_resource(
+                    b'mercurial.templates', rel
+                )
+            else:
+                dir = templatedir()
+                if dir:
+                    abs = os.path.normpath(os.path.join(dir, rel))
+                    if os.path.isfile(abs):
+                        subresource = util.posixfile(abs, b'rb')
         if subresource:
             data = subresource.read()
             conf.parse(



To: martinvonz, #hg-reviewers, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200806/a0f4eb8f/attachment-0002.html>


More information about the Mercurial-patches mailing list