D8804: templater: make templatepath() not return directory paths
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Jul 24 06:02:01 UTC 2020
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
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
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list