Mercurial > public > mercurial-scm > hg
comparison mercurial/revsetlang.py @ 41562:1c04894e8fe1
revset: allow to parse single integer as a range
Even though this wouldn't be any useful in followlines(), it helps to unify
range processing.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 27 Jan 2019 13:28:45 +0900 |
parents | 59638c6fcb70 |
children | ddb174511f1b |
comparison
equal
deleted
inserted
replaced
41561:59638c6fcb70 | 41562:1c04894e8fe1 |
---|---|
244 """Get [first, last] integer range (both inclusive) from a parsed tree | 244 """Get [first, last] integer range (both inclusive) from a parsed tree |
245 | 245 |
246 If any of the sides omitted, and if no default provided, ParseError will | 246 If any of the sides omitted, and if no default provided, ParseError will |
247 be raised. | 247 be raised. |
248 """ | 248 """ |
249 if x and (x[0] == 'string' or x[0] == 'symbol'): | |
250 n = getinteger(x, err1) | |
251 return n, n | |
249 a, b = getrange(x, err1) | 252 a, b = getrange(x, err1) |
250 return getinteger(a, err2, deffirst), getinteger(b, err2, deflast) | 253 return getinteger(a, err2, deffirst), getinteger(b, err2, deflast) |
251 | 254 |
252 def getargs(x, min, max, err): | 255 def getargs(x, min, max, err): |
253 l = getlist(x) | 256 l = getlist(x) |