# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1470555368 -32400 # Sun Aug 07 16:36:08 2016 +0900 # Node ID 1c24a66616699350c48aee283da06906ec9b4efa # Parent 04d0742aa7ecb239a06ba46e9f8ebe0c52a86e9d revset: do not partial-match operator and function names in optimize()
It was error-prone, and actually there was a typo, s/ancestorspec/ancestor/. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2371,7 +2371,7 @@ def _optimize(x, small): elif op == 'negate': s = getstring(x[1], _("can't negate that")) return _optimize(('string', '-' + s), small) - elif op in 'string symbol': + elif op in ('string', 'symbol'): return smallbonus, x # single revisions are small elif op == 'and': wa, ta = _optimize(x[1], True) @@ -2434,7 +2434,7 @@ def _optimize(x, small): return o[0], (op, o[1]) elif op == 'group': return _optimize(x[1], small) - elif op in 'dagrange range parent ancestorspec': + elif op in ('dagrange', 'range', 'parent', 'ancestor'): wa, ta = _optimize(x[1], small) wb, tb = _optimize(x[2], small) return wa + wb, (op, ta, tb) @@ -2447,18 +2447,18 @@ def _optimize(x, small): elif op == 'func': f = getsymbol(x[1]) wa, ta = _optimize(x[2], small) - if f in ("author branch closed date desc file grep keyword " - "outgoing user"): + if f in ('author', 'branch', 'closed', 'date', 'desc', 'file', 'grep', + 'keyword', 'outgoing', 'user'): w = 10 # slow - elif f in "modifies adds removes": + elif f in ('modifies', 'adds', 'removes'): w = 30 # slower elif f == "contains": w = 100 # very slow elif f == "ancestor": w = 1 * smallbonus - elif f in "reverse limit first _intlist": + elif f in ('reverse', 'limit', 'first', '_intlist'): w = 0 - elif f in "sort": + elif f == "sort": w = 10 # assume most sorts look at changelog else: w = 1 _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel