##// END OF EJS Templates
revset: add %r for embedded revset support to formatspec...
Matt Mackall -
r15266:8bea39ca default
parent child Browse files
Show More
@@ -1055,14 +1055,17 b' def formatspec(expr, *args):'
1055 1055
1056 1056 Supported arguments:
1057 1057
1058 %r = revset expression, parenthesized
1058 1059 %d = int(arg), no quoting
1059 1060 %s = string(arg), escaped and single-quoted
1060 1061 %b = arg.branch(), escaped and single-quoted
1061 1062 %n = hex(arg), single-quoted
1062 1063 %% = a literal '%'
1063 1064
1064 Prefixing the type with 'l' specifies a list of that type.
1065 Prefixing the type with 'l' specifies a parenthesized list of that type.
1065 1066
1067 >>> formatspec('%d:: and %lr', 10, ("this()", "that()"))
1068 '10:: and ((this()) or (that()))'
1066 1069 >>> formatspec('%d:: and not %d::', 10, 20)
1067 1070 '10:: and not 20::'
1068 1071 >>> formatspec('keyword(%s)', 'foo\\xe9')
@@ -1083,6 +1086,9 b' def formatspec(expr, *args):'
1083 1086 return str(int(arg))
1084 1087 elif c == 's':
1085 1088 return quote(arg)
1089 elif c == 'r':
1090 parse(arg) # make sure syntax errors are confined
1091 return '(%s)' % arg
1086 1092 elif c == 'n':
1087 1093 return quote(node.hex(arg))
1088 1094 elif c == 'b':
General Comments 0
You need to be logged in to leave comments. Login now