[Request] [+ ] D8896: templater: try to read %include in mapfiles from resources
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Aug 5 17:10:59 UTC 2020
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
The "show" style is an example of a style that uses an "%include"
statement in its definition. This patch makes `hg log --style show`
work.
This takes the number of failing tests with PyOxidizer from 72 to 62.
REPOSITORY
rHG Mercurial
BRANCH
default
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
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200805/daf4d80f/attachment-0001.html>
More information about the Mercurial-patches
mailing list