[PATCH 1 of 3] revset: make optimize() reject unknown operators
Yuya Nishihara
yuya at tcha.org
Fri Sep 2 14:58:10 UTC 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1470549702 -32400
# Sun Aug 07 15:01:42 2016 +0900
# Node ID 5cb90003deb87ae58f620657ec891df26e04c72a
# Parent d130a38ef41f3c9e2d2f26df3535d89a93f87301
revset: make optimize() reject unknown operators
This should have caught the bug of 'keyvalue' operator fixed at 5004ef47f437.
The catch-all pattern is useless since optimize() should be aware of all known
operators.
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2463,7 +2463,7 @@ def _optimize(x, small):
else:
w = 1
return w + wa, (op, x[1], ta)
- return 1, x
+ raise ValueError('invalid operator %r' % op)
def optimize(tree):
_weight, newtree = _optimize(tree, small=True)
More information about the Mercurial-devel
mailing list