# HG changeset patch # User Yuya Nishihara # Date 2016-05-02 03:47:09 # Node ID 8c295c3b2ce2293fc0444e6177f93d004cd416b1 # Parent 7828cadd287391ca47462e032fc5d5a26afb2ee4 revset: introduce temporary variables in optimize() where they look better diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2099,8 +2099,8 @@ def optimize(x, small): if op == 'minus': return optimize(('and', x[1], ('not', x[2])), small) elif op == 'only': - return optimize(('func', ('symbol', 'only'), - ('list', x[1], x[2])), small) + t = ('func', ('symbol', 'only'), ('list', x[1], x[2])) + return optimize(t, small) elif op == 'onlypost': return optimize(('func', ('symbol', 'only'), x[1]), small) elif op == 'dagrangepre': @@ -2114,8 +2114,8 @@ def optimize(x, small): elif op == 'rangepost': return optimize(('range', x[1], ('string', 'tip')), small) elif op == 'negate': - return optimize(('string', - '-' + getstring(x[1], _("can't negate that"))), small) + s = getstring(x[1], _("can't negate that")) + return optimize(('string', '-' + s), small) elif op in 'string symbol negate': return smallbonus, x # single revisions are small elif op == 'and':