Mercurial > hg
comparison mercurial/revset.py @ 31998:83527d9f1f13
revset: properly parse "descend" argument of followlines()
We parse "descend" symbol as a Boolean using getboolean (prior extraction by
getargsdict already checked that it is a symbol).
In tests, check for error cases and vary Boolean values here and there.
author | Denis Laxalde <denis@laxalde.org> |
---|---|
date | Sat, 15 Apr 2017 11:29:42 +0200 |
parents | 5e3b49defbff |
children | 2a2744dffecf |
comparison
equal
deleted
inserted
replaced
31997:11f501f0a213 | 31998:83527d9f1f13 |
---|---|
30 | 30 |
31 # helpers for processing parsed tree | 31 # helpers for processing parsed tree |
32 getsymbol = revsetlang.getsymbol | 32 getsymbol = revsetlang.getsymbol |
33 getstring = revsetlang.getstring | 33 getstring = revsetlang.getstring |
34 getinteger = revsetlang.getinteger | 34 getinteger = revsetlang.getinteger |
35 getboolean = revsetlang.getboolean | |
35 getlist = revsetlang.getlist | 36 getlist = revsetlang.getlist |
36 getrange = revsetlang.getrange | 37 getrange = revsetlang.getrange |
37 getargs = revsetlang.getargs | 38 getargs = revsetlang.getargs |
38 getargsdict = revsetlang.getargsdict | 39 getargsdict = revsetlang.getargsdict |
39 | 40 |
942 fromline, toline = [getinteger(a, _("line range bounds must be integers")) | 943 fromline, toline = [getinteger(a, _("line range bounds must be integers")) |
943 for a in lr] | 944 for a in lr] |
944 fromline, toline = util.processlinerange(fromline, toline) | 945 fromline, toline = util.processlinerange(fromline, toline) |
945 | 946 |
946 fctx = repo[rev].filectx(fname) | 947 fctx = repo[rev].filectx(fname) |
947 if args.get('descend', False): | 948 descend = False |
949 if 'descend' in args: | |
950 descend = getboolean(args['descend'], | |
951 _("'descend' argument must be a boolean")) | |
952 if descend: | |
948 rs = generatorset( | 953 rs = generatorset( |
949 (c.rev() for c, _linerange | 954 (c.rev() for c, _linerange |
950 in context.blockdescendants(fctx, fromline, toline)), | 955 in context.blockdescendants(fctx, fromline, toline)), |
951 iterasc=True) | 956 iterasc=True) |
952 else: | 957 else: |