debugrevspec: add option to skip optimize() and evaluate unoptimized tree
authorYuya Nishihara <yuya@tcha.org>
Sun, 21 Aug 2016 12:40:02 +0900
changeset 29923 429fd2747d9a
parent 29922 ae933e3e2226
child 29924 45bf56a89197
debugrevspec: add option to skip optimize() and evaluate unoptimized tree This will help debugging optimizer bugs. Maybe '--no-optimized' can be changed to '--optimized' (default: True) when flags series landed.
mercurial/commands.py
tests/test-completion.t
tests/test-revset.t
--- a/mercurial/commands.py	Thu Sep 08 22:44:10 2016 +0900
+++ b/mercurial/commands.py	Sun Aug 21 12:40:02 2016 +0900
@@ -3515,6 +3515,7 @@
       _('print parsed tree after optimizing (DEPRECATED)')),
      ('p', 'show-stage', [],
       _('print parsed tree at the given stage'), _('NAME')),
+     ('', 'no-optimized', False, _('evaluate tree without optimization')),
      ],
     ('REVSPEC'))
 def debugrevspec(ui, repo, expr, **opts):
@@ -3530,6 +3531,8 @@
         ('analyzed', revset.analyze),
         ('optimized', revset.optimize),
     ]
+    if opts['no_optimized']:
+        stages = stages[:-1]
     stagenames = set(n for n, f in stages)
 
     showalways = set()
--- a/tests/test-completion.t	Thu Sep 08 22:44:10 2016 +0900
+++ b/tests/test-completion.t	Sun Aug 21 12:40:02 2016 +0900
@@ -269,7 +269,7 @@
   debugrebuildfncache: 
   debugrename: rev
   debugrevlog: changelog, manifest, dir, dump
-  debugrevspec: optimize, show-stage
+  debugrevspec: optimize, show-stage, no-optimized
   debugsetparents: 
   debugsub: rev
   debugsuccessorssets: 
--- a/tests/test-revset.t	Thu Sep 08 22:44:10 2016 +0900
+++ b/tests/test-revset.t	Sun Aug 21 12:40:02 2016 +0900
@@ -508,6 +508,21 @@
   hg: parse error: missing argument
   [255]
 
+  $ hg debugrevspec --no-optimized -p all '()'
+  * parsed:
+  (group
+    None)
+  * expanded:
+  (group
+    None)
+  * concatenated:
+  (group
+    None)
+  * analyzed:
+  None
+  hg: parse error: missing argument
+  [255]
+
   $ hg debugrevspec -p parsed -p analyzed -p optimized '(0|1)-1'
   * parsed:
   (minus
@@ -2058,6 +2073,32 @@
   5
   6
 
+unoptimized `or` looks like this
+
+  $ try --no-optimized -p analyzed '0|1|2|3|4'
+  * analyzed:
+  (or
+    ('symbol', '0')
+    ('symbol', '1')
+    ('symbol', '2')
+    ('symbol', '3')
+    ('symbol', '4'))
+  * set:
+  <addset
+    <addset
+      <baseset [0]>,
+      <baseset [1]>>,
+    <addset
+      <baseset [2]>,
+      <addset
+        <baseset [3]>,
+        <baseset [4]>>>>
+  0
+  1
+  2
+  3
+  4
+
 test that `_list` should be narrowed by provided `subset`
 
   $ log '0:2 and (null|1|2|3)'