Patchwork D8804: templater: make templatepath() not return directory paths

login
register
mail settings
Submitter phabricator
Date July 24, 2020, 6:02 a.m.
Message ID <differential-rev-PHID-DREV-nx2p6cr32ovyzfrxug6r-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46858/
State Superseded
Headers show

Comments

phabricator - July 24, 2020, 6:02 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The previous patch added a test showing an unusal error message. This
  make it more like other error messages.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/templater.py
  tests/test-template-map.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-template-map.t b/tests/test-template-map.t
--- a/tests/test-template-map.t
+++ b/tests/test-template-map.t
@@ -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:
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1065,7 +1065,7 @@ 
 def templatepath(name):
     '''return location of template file. returns None if not found.'''
     f = os.path.join(templatedir(), name)
-    if f and os.path.exists(f):
+    if f and os.path.isfile(f):
         return f
     return None