mercurial/templater.py
changeset 45776 0fc8b066928a
parent 45451 e53a3d0ef416
child 45886 18489e26d9a0
equal deleted inserted replaced
45775:5bb900885311 45776:0fc8b066928a
   310         raise
   310         raise
   311     yield (b'end', None, pos)
   311     yield (b'end', None, pos)
   312 
   312 
   313 
   313 
   314 def _addparseerrorhint(inst, tmpl):
   314 def _addparseerrorhint(inst, tmpl):
   315     if len(inst.args) <= 1:
   315     if inst.location is None:
   316         return  # no location
   316         return
   317     loc = inst.args[1]
   317     loc = inst.location
   318     # Offset the caret location by the number of newlines before the
   318     # Offset the caret location by the number of newlines before the
   319     # location of the error, since we will replace one-char newlines
   319     # location of the error, since we will replace one-char newlines
   320     # with the two-char literal r'\n'.
   320     # with the two-char literal r'\n'.
   321     offset = tmpl[:loc].count(b'\n')
   321     offset = tmpl[:loc].count(b'\n')
   322     tmpl = tmpl.replace(b'\n', br'\n')
   322     tmpl = tmpl.replace(b'\n', br'\n')