changeset 45259:9a308336fe41

templater: make templatepath() not return directory paths The previous patch added a test showing an unusal error message. This make it more like other error messages. Differential Revision: https://phab.mercurial-scm.org/D8804
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 23 Jul 2020 22:47:55 -0700
parents 46c8db8d4e03
children 653b2a439412
files mercurial/templater.py tests/test-template-map.t
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Thu Jul 23 22:44:18 2020 -0700
+++ b/mercurial/templater.py	Thu Jul 23 22:47:55 2020 -0700
@@ -1072,7 +1072,7 @@
     if dir is None:
         return None
     f = os.path.join(templatedir(), name)
-    if f and os.path.exists(f):
+    if f and os.path.isfile(f):
         return f
     return None
 
--- a/tests/test-template-map.t	Thu Jul 23 22:44:18 2020 -0700
+++ b/tests/test-template-map.t	Thu Jul 23 22:47:55 2020 -0700
@@ -1284,7 +1284,8 @@
 Error if style is a directory whose name is a built-in style:
 
   $ hg log --style coal
-  abort: Is a directory: '*/mercurial/templates/coal' (glob)
+  abort: style 'coal' not found
+  (available styles: bisect, changelog, compact, default, phases, show, status, xml)
   [255]
 
 Error if style missing key: