Mercurial > hg-stable
changeset 15325:cdf1daa3b83f stable
revset: deal with empty lists in formatspec
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 21 Oct 2011 12:12:21 -0500 |
parents | 0890842c41d1 |
children | 8ae2900d6d9b |
files | mercurial/revset.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Fri Oct 21 12:07:27 2011 +0100 +++ b/mercurial/revset.py Fri Oct 21 12:12:21 2011 -0500 @@ -1068,6 +1068,8 @@ '(10 or 11):: and ((this()) or (that()))' >>> formatspec('%d:: and not %d::', 10, 20) '10:: and not 20::' + >>> formatspec('%ld or %ld', [], [1]) + '(0-0) or (1)' >>> formatspec('keyword(%s)', 'foo\\xe9') "keyword('foo\\\\xe9')" >>> b = lambda: 'default' @@ -1111,7 +1113,10 @@ # a list of some type pos += 1 d = expr[pos] - lv = ' or '.join(argtype(d, e) for e in args[arg]) + if args[arg]: + lv = ' or '.join(argtype(d, e) for e in args[arg]) + else: + lv = '0-0' # a minimal way to represent an empty set ret += '(%s)' % lv arg += 1 else: