comparison mercurial/fileset.py @ 36505:db33c5bc781f

fileset: drop bad "elif:" trying to check invalid size expression Since str.isdigit is a function, the last "elif" was always true. An invalid expression is rejected by util.sizetoint(), so we don't need "elif".
author Yuya Nishihara <yuya@tcha.org>
date Thu, 01 Mar 2018 04:50:22 -0500
parents ab5f18a9dcac
children f0b6fbea00cf
comparison
equal deleted inserted replaced
36504:b075f45456a5 36505:db33c5bc781f
390 a = util.sizetoint(expr[2:]) 390 a = util.sizetoint(expr[2:])
391 return lambda x: x >= a 391 return lambda x: x >= a
392 elif expr.startswith(">"): 392 elif expr.startswith(">"):
393 a = util.sizetoint(expr[1:]) 393 a = util.sizetoint(expr[1:])
394 return lambda x: x > a 394 return lambda x: x > a
395 elif expr[0:1].isdigit or expr.startswith('.'): 395 else:
396 a = util.sizetoint(expr) 396 a = util.sizetoint(expr)
397 b = _sizetomax(expr) 397 b = _sizetomax(expr)
398 return lambda x: x >= a and x <= b 398 return lambda x: x >= a and x <= b
399 raise error.ParseError(_("couldn't parse size: %s") % expr)
400 399
401 @predicate('size(expression)', callexisting=True) 400 @predicate('size(expression)', callexisting=True)
402 def size(mctx, x): 401 def size(mctx, x):
403 """File size matches the given expression. Examples: 402 """File size matches the given expression. Examples:
404 403