changeset 31611:0b3eb280564b

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.
author Augie Fackler <augie@google.com>
date Thu, 23 Mar 2017 10:46:50 -0400
parents 0b94c19b641c
children aea8ec3f7dd1
files mercurial/revsetlang.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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):
     '''