revsetlang: perform quoting using ui.escapestr instead of repr()
authorAugie Fackler <augie@google.com>
Thu, 23 Mar 2017 10:46:50 -0400
changeset 31611 0b3eb280564b
parent 31610 0b94c19b641c
child 31612 aea8ec3f7dd1
revsetlang: perform quoting using ui.escapestr instead of repr() This changes one of the doctest results, but I'm pretty sure on inspection that it's an equivalent result.
mercurial/revsetlang.py
--- a/mercurial/revsetlang.py	Thu Mar 23 10:41:34 2017 -0400
+++ b/mercurial/revsetlang.py	Thu Mar 23 10:46:50 2017 -0400
@@ -15,6 +15,7 @@
     node,
     parser,
     pycompat,
+    util,
 )
 
 elements = {
@@ -581,11 +582,11 @@
     >>> _quote("asdf'\"")
     '\'asdf\\\'"\''
     >>> _quote('asdf\'')
-    '"asdf\'"'
+    "'asdf\\''"
     >>> _quote(1)
     "'1'"
     """
-    return repr(str(s))
+    return "'%s'" % util.escapestr('%s' % s)
 
 def formatspec(expr, *args):
     '''