revsetlang: move quoting function to not be a closure
authorAugie Fackler <augie@google.com>
Sun, 19 Mar 2017 01:14:19 -0400
changeset 31604 7eac6fcf2ffa
parent 31603 fbe8502c4480
child 31605 0b94c19b641c
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.
mercurial/revsetlang.py
--- 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)