mercurial/revsetlang.py
changeset 31606 0b3eb280564b
parent 31605 0b94c19b641c
child 31636 f3b151278655
equal deleted inserted replaced
31605:0b94c19b641c 31606:0b3eb280564b
    13 from . import (
    13 from . import (
    14     error,
    14     error,
    15     node,
    15     node,
    16     parser,
    16     parser,
    17     pycompat,
    17     pycompat,
       
    18     util,
    18 )
    19 )
    19 
    20 
    20 elements = {
    21 elements = {
    21     # token-type: binding-strength, primary, prefix, infix, suffix
    22     # token-type: binding-strength, primary, prefix, infix, suffix
    22     "(": (21, None, ("group", 1, ")"), ("func", 1, ")"), None),
    23     "(": (21, None, ("group", 1, ")"), ("func", 1, ")"), None),
   579     >>> _quote('asdf')
   580     >>> _quote('asdf')
   580     "'asdf'"
   581     "'asdf'"
   581     >>> _quote("asdf'\"")
   582     >>> _quote("asdf'\"")
   582     '\'asdf\\\'"\''
   583     '\'asdf\\\'"\''
   583     >>> _quote('asdf\'')
   584     >>> _quote('asdf\'')
   584     '"asdf\'"'
   585     "'asdf\\''"
   585     >>> _quote(1)
   586     >>> _quote(1)
   586     "'1'"
   587     "'1'"
   587     """
   588     """
   588     return repr(str(s))
   589     return "'%s'" % util.escapestr('%s' % s)
   589 
   590 
   590 def formatspec(expr, *args):
   591 def formatspec(expr, *args):
   591     '''
   592     '''
   592     This is a convenience function for using revsets internally, and
   593     This is a convenience function for using revsets internally, and
   593     escapes arguments appropriately. Aliases are intentionally ignored
   594     escapes arguments appropriately. Aliases are intentionally ignored