equal
deleted
inserted
replaced
571 return tuple(foldconcat(t) for t in tree) |
571 return tuple(foldconcat(t) for t in tree) |
572 |
572 |
573 def parse(spec, lookup=None): |
573 def parse(spec, lookup=None): |
574 return _parsewith(spec, lookup=lookup) |
574 return _parsewith(spec, lookup=lookup) |
575 |
575 |
|
576 def _quote(s): |
|
577 return repr(str(s)) |
|
578 |
576 def formatspec(expr, *args): |
579 def formatspec(expr, *args): |
577 ''' |
580 ''' |
578 This is a convenience function for using revsets internally, and |
581 This is a convenience function for using revsets internally, and |
579 escapes arguments appropriately. Aliases are intentionally ignored |
582 escapes arguments appropriately. Aliases are intentionally ignored |
580 so that intended expression behavior isn't accidentally subverted. |
583 so that intended expression behavior isn't accidentally subverted. |
604 "branch('default')" |
607 "branch('default')" |
605 >>> formatspec('root(%ls)', ['a', 'b', 'c', 'd']) |
608 >>> formatspec('root(%ls)', ['a', 'b', 'c', 'd']) |
606 "root(_list('a\\x00b\\x00c\\x00d'))" |
609 "root(_list('a\\x00b\\x00c\\x00d'))" |
607 ''' |
610 ''' |
608 |
611 |
609 def quote(s): |
|
610 return repr(str(s)) |
|
611 |
|
612 def argtype(c, arg): |
612 def argtype(c, arg): |
613 if c == 'd': |
613 if c == 'd': |
614 return '%d' % int(arg) |
614 return '%d' % int(arg) |
615 elif c == 's': |
615 elif c == 's': |
616 return quote(arg) |
616 return _quote(arg) |
617 elif c == 'r': |
617 elif c == 'r': |
618 parse(arg) # make sure syntax errors are confined |
618 parse(arg) # make sure syntax errors are confined |
619 return '(%s)' % arg |
619 return '(%s)' % arg |
620 elif c == 'n': |
620 elif c == 'n': |
621 return quote(node.hex(arg)) |
621 return _quote(node.hex(arg)) |
622 elif c == 'b': |
622 elif c == 'b': |
623 return quote(arg.branch()) |
623 return _quote(arg.branch()) |
624 |
624 |
625 def listexp(s, t): |
625 def listexp(s, t): |
626 l = len(s) |
626 l = len(s) |
627 if l == 0: |
627 if l == 0: |
628 return "_list('')" |
628 return "_list('')" |