changeset 6337:d2713d902524

give better error message on non-existent mapfile (issue813)
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 21 Mar 2008 12:05:01 +0100
parents 4b0c9c674707
children 0750f11152fe
files mercurial/templater.py tests/test-command-template.out
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Fri Mar 21 11:06:02 2008 +0100
+++ b/mercurial/templater.py	Fri Mar 21 12:05:01 2008 +0100
@@ -7,6 +7,7 @@
 
 from i18n import _
 import re, sys, os
+from mercurial import util
 
 def parsestring(s, quoted=True):
     '''parse a string using simple c-like syntax.
@@ -55,6 +56,9 @@
 
         if not mapfile:
             return
+        if not os.path.exists(mapfile):
+            raise util.Abort(_('style not found: %s') % mapfile)
+
         i = 0
         for l in file(mapfile):
             l = l.strip()
--- a/tests/test-command-template.out	Fri Mar 21 11:06:02 2008 +0100
+++ b/tests/test-command-template.out	Fri Mar 21 12:05:01 2008 +0100
@@ -83,7 +83,7 @@
 # error if style not readable
 abort: Permission denied: ./q
 # error if no style
-abort: No such file or directory: notexist
+abort: style not found: notexist
 # error if style missing key
 abort: ./t: no key named 'changeset'
 # error if include fails