[PATCH 5 of 6 py3 v2] revsetlang: perform quoting using ui.escapestr instead of repr()
Augie Fackler
raf at durin42.com
Fri Mar 24 11:02:28 EDT 2017
On Fri, Mar 24, 2017 at 10:59 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> On Thu, 23 Mar 2017 11:11:38 -0400, Augie Fackler wrote:
>> # 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()
>
>> @@ -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)
> ^^^^^^^^
>
> Ah, found nit. I don't know if _quote(int) is necessary, but b'%s' can't be
> used to convert int to byte string on Python 3. pycompat.bytestr() should
> do a job.
Should I send a followup?
More information about the Mercurial-devel
mailing list