Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 29933:91a95ad985d8
revset: add 'takeorder' attribute to mark functions that need ordering flag
Since most functions shouldn't need 'order' flag, it is passed only when
explicitly required. This avoids large API breakage.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 07 Aug 2016 17:58:50 +0900 |
parents | 09a84e747c88 |
children | 2c6a05b938d8 |
comparison
equal
deleted
inserted
replaced
29932:09a84e747c88 | 29933:91a95ad985d8 |
---|---|
420 raise error.ParseError(_("can't use a key-value pair in this context")) | 420 raise error.ParseError(_("can't use a key-value pair in this context")) |
421 | 421 |
422 def func(repo, subset, a, b, order): | 422 def func(repo, subset, a, b, order): |
423 f = getsymbol(a) | 423 f = getsymbol(a) |
424 if f in symbols: | 424 if f in symbols: |
425 return symbols[f](repo, subset, b) | 425 fn = symbols[f] |
426 if getattr(fn, '_takeorder', False): | |
427 return fn(repo, subset, b, order) | |
428 return fn(repo, subset, b) | |
426 | 429 |
427 keep = lambda fn: getattr(fn, '__doc__', None) is not None | 430 keep = lambda fn: getattr(fn, '__doc__', None) is not None |
428 | 431 |
429 syms = [s for (s, fn) in symbols.items() if keep(fn)] | 432 syms = [s for (s, fn) in symbols.items() if keep(fn)] |
430 raise error.UnknownIdentifier(f, syms) | 433 raise error.UnknownIdentifier(f, syms) |