changeset 31604:7eac6fcf2ffa

revsetlang: move quoting function to not be a closure I'm about to change the implementation here and I'd like to add some doctests, which means this needs to not be hidden inside another function.
author Augie Fackler <augie@google.com>
date Sun, 19 Mar 2017 01:14:19 -0400
parents fbe8502c4480
children 0b94c19b641c
files mercurial/revsetlang.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revsetlang.py	Thu Mar 23 10:33:20 2017 -0400
+++ b/mercurial/revsetlang.py	Sun Mar 19 01:14:19 2017 -0400
@@ -573,6 +573,9 @@
 def parse(spec, lookup=None):
     return _parsewith(spec, lookup=lookup)
 
+def _quote(s):
+    return repr(str(s))
+
 def formatspec(expr, *args):
     '''
     This is a convenience function for using revsets internally, and
@@ -606,21 +609,18 @@
     "root(_list('a\\x00b\\x00c\\x00d'))"
     '''
 
-    def quote(s):
-        return repr(str(s))
-
     def argtype(c, arg):
         if c == 'd':
             return '%d' % int(arg)
         elif c == 's':
-            return quote(arg)
+            return _quote(arg)
         elif c == 'r':
             parse(arg) # make sure syntax errors are confined
             return '(%s)' % arg
         elif c == 'n':
-            return quote(node.hex(arg))
+            return _quote(node.hex(arg))
         elif c == 'b':
-            return quote(arg.branch())
+            return _quote(arg.branch())
 
     def listexp(s, t):
         l = len(s)