diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -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 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: