##// END OF EJS Templates
revset: deal with empty lists in formatspec
Matt Mackall -
r15325:cdf1daa3 stable
parent child Browse files
Show More
@@ -1068,6 +1068,8 b' def formatspec(expr, *args):'
1068 1068 '(10 or 11):: and ((this()) or (that()))'
1069 1069 >>> formatspec('%d:: and not %d::', 10, 20)
1070 1070 '10:: and not 20::'
1071 >>> formatspec('%ld or %ld', [], [1])
1072 '(0-0) or (1)'
1071 1073 >>> formatspec('keyword(%s)', 'foo\\xe9')
1072 1074 "keyword('foo\\\\xe9')"
1073 1075 >>> b = lambda: 'default'
@@ -1111,7 +1113,10 b' def formatspec(expr, *args):'
1111 1113 # a list of some type
1112 1114 pos += 1
1113 1115 d = expr[pos]
1116 if args[arg]:
1114 1117 lv = ' or '.join(argtype(d, e) for e in args[arg])
1118 else:
1119 lv = '0-0' # a minimal way to represent an empty set
1115 1120 ret += '(%s)' % lv
1116 1121 arg += 1
1117 1122 else:
General Comments 0
You need to be logged in to leave comments. Login now