diff tests/test-revset.t @ 25995:4f703dcc626f stable

revset: prevent crash caused by empty group expression while optimizing "and" An empty group expression "()" generates None in AST, so the optimizer have to test it before destructuring a tuple. The error message, "missing argument", is somewhat obscure, but it should be better than crash.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 09 Aug 2015 16:06:36 +0900
parents be29d26e2949
children b12e00a05d57
line wrap: on
line diff
--- a/tests/test-revset.t	Sat Aug 08 14:42:27 2015 +0800
+++ b/tests/test-revset.t	Sun Aug 09 16:06:36 2015 +0900
@@ -1230,6 +1230,23 @@
   5
   6
 
+no crash by empty group "()" while optimizing to "only()"
+
+  $ try --optimize '::1 and ()'
+  (and
+    (dagrangepre
+      ('symbol', '1'))
+    (group
+      None))
+  * optimized:
+  (and
+    None
+    (func
+      ('symbol', 'ancestors')
+      ('symbol', '1')))
+  hg: parse error: missing argument
+  [255]
+
 we can use patterns when searching for tags
 
   $ log 'tag("1..*")'