Patchwork debugrevspec: show expanded/concatenated states before printing trees

login
register
mail settings
Submitter Yuya Nishihara
Date March 26, 2016, 4:08 p.m.
Message ID <77710171e7222f696de2.1459008528@mimosa>
Download mbox | patch
Permalink /patch/14085/
State Accepted
Headers show

Comments

Yuya Nishihara - March 26, 2016, 4:08 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1458986472 -32400
#      Sat Mar 26 19:01:12 2016 +0900
# Node ID 77710171e7222f696de28d99d68b72ad0552c946
# Parent  4124288600c9eb8c229bcf98eb6902caf7fbbcad
debugrevspec: show expanded/concatenated states before printing trees

The debugrevspec command prints at most 4 parsed trees. It wasn't easy to
tell which tree belongs to which state.
Sean Farley - March 27, 2016, 1:42 a.m.
Yuya Nishihara <yuya@tcha.org> writes:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1458986472 -32400
> #      Sat Mar 26 19:01:12 2016 +0900
> # Node ID 77710171e7222f696de28d99d68b72ad0552c946
> # Parent  4124288600c9eb8c229bcf98eb6902caf7fbbcad
> debugrevspec: show expanded/concatenated states before printing trees
>
> The debugrevspec command prints at most 4 parsed trees. It wasn't easy to
> tell which tree belongs to which state.

Sure, sounds good to me.
Pierre-Yves David - March 27, 2016, 4:51 a.m.
On 03/26/2016 06:42 PM, Sean Farley wrote:
>
> Yuya Nishihara <yuya@tcha.org> writes:
>
>> # HG changeset patch
>> # User Yuya Nishihara <yuya@tcha.org>
>> # Date 1458986472 -32400
>> #      Sat Mar 26 19:01:12 2016 +0900
>> # Node ID 77710171e7222f696de28d99d68b72ad0552c946
>> # Parent  4124288600c9eb8c229bcf98eb6902caf7fbbcad
>> debugrevspec: show expanded/concatenated states before printing trees
>>
>> The debugrevspec command prints at most 4 parsed trees. It wasn't easy to
>> tell which tree belongs to which state.
>
> Sure, sounds good to me.

And this is pushed, thanks

Cheers,

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3463,11 +3463,11 @@  def debugrevspec(ui, repo, expr, **opts)
         ui.note(revset.prettyformat(tree), "\n")
         newtree = revset.findaliases(ui, tree)
         if newtree != tree:
-            ui.note(revset.prettyformat(newtree), "\n")
+            ui.note("* expanded:\n", revset.prettyformat(newtree), "\n")
         tree = newtree
         newtree = revset.foldconcat(tree)
         if newtree != tree:
-            ui.note(revset.prettyformat(newtree), "\n")
+            ui.note("* concatenated:\n", revset.prettyformat(newtree), "\n")
         if opts["optimize"]:
             weight, optimizedtree = revset.optimize(newtree, True)
             ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -1590,6 +1590,7 @@  aliases:
 
   $ try m
   ('symbol', 'm')
+  * expanded:
   (func
     ('symbol', 'merge')
     None)
@@ -1610,6 +1611,7 @@  aliases:
   $ export HGPLAINEXCEPT
   $ try m
   ('symbol', 'm')
+  * expanded:
   (func
     ('symbol', 'merge')
     None)
@@ -1626,6 +1628,7 @@  aliases:
   (func
     ('symbol', 'p2')
     ('symbol', '.'))
+  * expanded:
   (func
     ('symbol', 'p1')
     ('symbol', '.'))
@@ -1648,6 +1651,7 @@  aliases:
   (func
     ('symbol', 'p2')
     ('symbol', '.'))
+  * expanded:
   (func
     ('symbol', 'p1')
     ('symbol', '.'))
@@ -1662,6 +1666,7 @@  test alias recursion
 
   $ try sincem
   ('symbol', 'sincem')
+  * expanded:
   (func
     ('symbol', 'descendants')
     (func
@@ -1697,6 +1702,7 @@  test infinite recursion
           ('symbol', '1')
           ('symbol', '2')))
       ('symbol', '3')))
+  * expanded:
   (or
     ('symbol', '3')
     (or
@@ -1721,6 +1727,7 @@  test nesting and variable passing
     (range
       ('symbol', '2')
       ('symbol', '5')))
+  * expanded:
   (func
     ('symbol', 'max')
     (range
@@ -1749,6 +1756,7 @@  test chained `or` operations are flatten
       (range
         ('symbol', '2')
         ('symbol', '3'))))
+  * expanded:
   (or
     (range
       ('symbol', '0')
@@ -1782,6 +1790,7 @@  far away.
     (range
       ('symbol', '2')
       ('symbol', '5')))
+  * expanded:
   (func
     ('symbol', 'descendants')
     (func
@@ -1829,6 +1838,7 @@  far away.
     (list
       ('string', 'foo')
       ('symbol', 'tip')))
+  * expanded:
   (or
     ('symbol', 'tip')
     (func
@@ -1848,6 +1858,7 @@  far away.
     (range
       ('symbol', '2')
       ('symbol', '5')))
+  * expanded:
   (func
     ('symbol', 'reverse')
     (func
@@ -1871,6 +1882,7 @@  far away.
         ('symbol', '2')
         ('symbol', '3'))
       ('symbol', 'date')))
+  * expanded:
   (func
     ('symbol', 'reverse')
     (func
@@ -1915,6 +1927,7 @@  far away.
       ('symbol', 'x')
       ('symbol', 'x')
       ('symbol', 'date')))
+  * expanded:
   (func
     ('symbol', 'reverse')
     (func
@@ -2134,6 +2147,7 @@  tests for concatenation of strings/symbo
         ('string', '5f5'))
       ('symbol', '1ee'))
     ('string', 'ce5'))
+  * concatenated:
   ('string', '2785f51eece5')
   * set:
   <baseset [0]>
@@ -2148,6 +2162,7 @@  tests for concatenation of strings/symbo
       ('string', '5f5')
       ('symbol', '1ee')
       ('string', 'ce5')))
+  * expanded:
   (_concat
     (_concat
       (_concat
@@ -2155,6 +2170,7 @@  tests for concatenation of strings/symbo
         ('string', '5f5'))
       ('symbol', '1ee'))
     ('string', 'ce5'))
+  * concatenated:
   ('string', '2785f51eece5')
   * set:
   <baseset [0]>