# HG changeset patch # User Augie Fackler # Date 1490280094 14400 # Node ID 0b94c19b641cbac5dccd13445d501bb5ff112fba # Parent 7eac6fcf2ffaf24e91efd9f37d4c2f2407c1e571 revsetlang: add docstring with some tests to _quote diff -r 7eac6fcf2ffa -r 0b94c19b641c mercurial/revsetlang.py --- a/mercurial/revsetlang.py Sun Mar 19 01:14:19 2017 -0400 +++ b/mercurial/revsetlang.py Thu Mar 23 10:41:34 2017 -0400 @@ -574,6 +574,17 @@ return _parsewith(spec, lookup=lookup) def _quote(s): + r"""Quote a value in order to make it safe for the revset engine. + + >>> _quote('asdf') + "'asdf'" + >>> _quote("asdf'\"") + '\'asdf\\\'"\'' + >>> _quote('asdf\'') + '"asdf\'"' + >>> _quote(1) + "'1'" + """ return repr(str(s)) def formatspec(expr, *args):