[PATCH 2 of 2] templater: rename parsestring() to unquotestring() (API)

Augie Fackler raf at durin42.com
Fri May 8 10:00:06 CDT 2015


On Fri, May 08, 2015 at 07:35:50AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1430701393 -32400
> #      Mon May 04 10:03:13 2015 +0900
> # Node ID ffbf439033daf79e5e32416c40066fee5f4a3503
> # Parent  700144f73e6b4fef8a8ef77e767572ddb70d3aa6
> templater: rename parsestring() to unquotestring() (API)

These two look good, thanks. Queued for default.

>
> Since db7463aa080f, it doesn't parse string escapes.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1443,7 +1443,7 @@ def gettemplate(ui, tmpl, style):
>          tmpl = ui.config('ui', 'logtemplate')
>          if tmpl:
>              try:
> -                tmpl = templater.parsestring(tmpl)
> +                tmpl = templater.unquotestring(tmpl)
>              except SyntaxError:
>                  pass
>              return tmpl, None
> @@ -1477,7 +1477,7 @@ def gettemplate(ui, tmpl, style):
>      t = ui.config('templates', tmpl)
>      if t:
>          try:
> -            tmpl = templater.parsestring(t)
> +            tmpl = templater.unquotestring(t)
>          except SyntaxError:
>              tmpl = t
>          return tmpl, None
> diff --git a/mercurial/templater.py b/mercurial/templater.py
> --- a/mercurial/templater.py
> +++ b/mercurial/templater.py
> @@ -618,7 +618,7 @@ def _flatten(thing):
>                  for j in _flatten(i):
>                      yield j
>
> -def parsestring(s):
> +def unquotestring(s):
>      '''unwrap quotes'''
>      if len(s) < 2 or s[0] != s[-1]:
>          raise SyntaxError(_('unmatched quotes'))
> @@ -714,7 +714,7 @@ class templater(object):
>                  raise SyntaxError(_('%s: missing value') % conf.source('', key))
>              if val[0] in "'\"":
>                  try:
> -                    self.cache[key] = parsestring(val)
> +                    self.cache[key] = unquotestring(val)
>                  except SyntaxError, inst:
>                      raise SyntaxError('%s: %s' %
>                                        (conf.source('', key), inst.args[0]))
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list