Skip to content
Snippets Groups Projects
Commit 0b94c19b authored by Augie Fackler's avatar Augie Fackler
Browse files

revsetlang: add docstring with some tests to _quote

parent 7eac6fcf
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment