stack: reverse the display order
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 01 Apr 2016 16:57:11 -0700
changeset 1956 d8f1e432b16a
parent 1955 5452a575b4e5
child 1957 ea5553e47027
stack: reverse the display order Most mercurial command display the most recent changeset first. We put `hg topic --list` inline with this.
hgext3rd/topic/stack.py
tests/test-topic-stack.t
--- a/hgext3rd/topic/stack.py	Fri Apr 01 16:55:24 2016 -0700
+++ b/hgext3rd/topic/stack.py	Fri Apr 01 16:57:11 2016 -0700
@@ -33,7 +33,7 @@
         prev = r
 
     # super crude initial version
-    for idx, ctx in entries:
+    for idx, ctx in entries[::-1]:
         if idx is None:
             symbol = '_'
             state = 'base'
--- a/tests/test-topic-stack.t	Fri Apr 01 16:55:24 2016 -0700
+++ b/tests/test-topic-stack.t	Fri Apr 01 16:57:11 2016 -0700
@@ -54,11 +54,11 @@
   $ hg topic
    * foo
   $ hg topic --list
-    _ c_b
-  t1: c_c
+  t4@ c_f (current)
+  t3: c_e
   t2: c_d
-  t3: c_e
-  t4@ c_f (current)
+  t1: c_c
+    _ c_b
 
 error case, nothing to list
 
@@ -102,11 +102,11 @@
   o  0 default {} draft c_a
   
   $ hg topic --list
-    _ c_b
-  t1: c_c
+  t4$ c_f (unstable)
+  t3$ c_e (unstable)
   t2@ c_d (current)
-  t3$ c_e (unstable)
-  t4$ c_f (unstable)
+  t1: c_c
+    _ c_b
 
 Also test the revset:
 
@@ -170,14 +170,14 @@
 Test output
 
   $ hg top -l
-    _ c_b
-  t1: c_c
-  t2: c_d
+  t6: c_f
+  t5: c_e
+    _ c_d
+  t4@ c_h (current)
   t3: c_g
-  t4@ c_h (current)
-    _ c_d
-  t5: c_e
-  t6: c_f
+  t2: c_d
+  t1: c_c
+    _ c_b
 
 Case with multiple heads on the topic with unstability involved
 ---------------------------------------------------------------
@@ -212,11 +212,11 @@
   
 
   $ hg topic --list
-    _ c_b
-  t1: c_c
-  t2@ c_D (current)
+  t6$ c_f (unstable)
+  t5$ c_e (unstable)
+    _ c_D
+  t4: c_h
   t3: c_g
-  t4: c_h
-    _ c_D
-  t5$ c_e (unstable)
-  t6$ c_f (unstable)
+  t2@ c_D (current)
+  t1: c_c
+    _ c_b