# HG changeset patch # User Augie Fackler # Date 2017-03-23 14:46:50 # Node ID 0b3eb280564b7dbbc6e6adc1c34b295c80b01ba2 # Parent 0b94c19b641cbac5dccd13445d501bb5ff112fba 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): '''