comparison mercurial/fileset.py @ 25925:23c4589fc678 stable

filesets: ignore unit case in size() predicate for single value When specifying one plain value in size(), e.g. size(1k), fileset tries to guess the upper bound automatically (see the comment in _sizetomax()). It didn't ignore the specified unit's case, and so size("1 GB"), for example, produced this error: hg: parse error: couldn't parse size: 1 GB Let's do the same thing that util.sizetoint() does: .lower(). The two test lines without output just check that there are no parse errors.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 08 Aug 2015 14:42:27 +0800
parents e71e5629e006
children a7527c5769bb
comparison
equal deleted inserted replaced
25911:f4386cb3252e 25925:23c4589fc678
285 raise error.ParseError(_('invalid match pattern: %s') % e) 285 raise error.ParseError(_('invalid match pattern: %s') % e)
286 return [f for f in mctx.existing() if r.search(mctx.ctx[f].data())] 286 return [f for f in mctx.existing() if r.search(mctx.ctx[f].data())]
287 287
288 def _sizetomax(s): 288 def _sizetomax(s):
289 try: 289 try:
290 s = s.strip() 290 s = s.strip().lower()
291 for k, v in util._sizeunits: 291 for k, v in util._sizeunits:
292 if s.endswith(k): 292 if s.endswith(k):
293 # max(4k) = 5k - 1, max(4.5k) = 4.6k - 1 293 # max(4k) = 5k - 1, max(4.5k) = 4.6k - 1
294 n = s[:-len(k)] 294 n = s[:-len(k)]
295 inc = 1.0 295 inc = 1.0