mercurial/templater.py
changeset 6337 d2713d902524
parent 5976 9f1e6ab76069
child 6434 62e0bb41e682
equal deleted inserted replaced
6336:4b0c9c674707 6337:d2713d902524
     5 # This software may be used and distributed according to the terms
     5 # This software may be used and distributed according to the terms
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 
     7 
     8 from i18n import _
     8 from i18n import _
     9 import re, sys, os
     9 import re, sys, os
       
    10 from mercurial import util
    10 
    11 
    11 def parsestring(s, quoted=True):
    12 def parsestring(s, quoted=True):
    12     '''parse a string using simple c-like syntax.
    13     '''parse a string using simple c-like syntax.
    13     string must be in quotes if quoted is True.'''
    14     string must be in quotes if quoted is True.'''
    14     if quoted:
    15     if quoted:
    53         self.filters = filters
    54         self.filters = filters
    54         self.defaults = defaults
    55         self.defaults = defaults
    55 
    56 
    56         if not mapfile:
    57         if not mapfile:
    57             return
    58             return
       
    59         if not os.path.exists(mapfile):
       
    60             raise util.Abort(_('style not found: %s') % mapfile)
       
    61 
    58         i = 0
    62         i = 0
    59         for l in file(mapfile):
    63         for l in file(mapfile):
    60             l = l.strip()
    64             l = l.strip()
    61             i += 1
    65             i += 1
    62             if not l or l[0] in '#;': continue
    66             if not l or l[0] in '#;': continue