--- a/mercurial/templater.py Thu Jul 30 15:29:06 2020 -0700
+++ b/mercurial/templater.py Thu Jul 30 21:36:29 2020 -0700
@@ -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(