[PATCH 5 of 6 py3 v2] revsetlang: perform quoting using ui.escapestr instead of repr()

Augie Fackler raf at durin42.com
Thu Mar 23 11:11:38 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1490280410 14400
#      Thu Mar 23 10:46:50 2017 -0400
# Node ID 2190115dab97a551cd5aac44a8a55e2df9fd6307
# Parent  6158a45eb9f22ee651f2677b420665788fcc72e2
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.

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -15,6 +15,7 @@ from . import (
     node,
     parser,
     pycompat,
+    util,
 )
 
 elements = {
@@ -581,11 +582,11 @@ def _quote(s):
     >>> _quote("asdf'\"")
     '\'asdf\\\'"\''
     >>> _quote('asdf\'')
-    '"asdf\'"'
+    "'asdf\\''"
     >>> _quote(1)
     "'1'"
     """
-    return repr(str(s))
+    return "'%s'" % util.escapestr('%s' % s)
 
 def formatspec(expr, *args):
     '''


More information about the Mercurial-devel mailing list