stack: make @ (current) more important than $ (some sort of unstable)
authorAnton Shestakov <av6@dwimlabs.net>
Sun, 10 Mar 2019 18:50:00 +0800
changeset 4436 ef155f624670
parent 4435 7915aef191ff
child 4437 da2fdaa3d97c
stack: make @ (current) more important than $ (some sort of unstable) Base is still ^ even if it's currently checked out.
hgext3rd/topic/stack.py
tests/test-evolve-topic.t
tests/test-stack-branch.t
tests/test-topic-stack-complex.t
tests/test-topic-stack.t
--- a/hgext3rd/topic/stack.py	Sat Mar 09 13:13:53 2019 +0800
+++ b/hgext3rd/topic/stack.py	Sun Mar 10 18:50:00 2019 +0800
@@ -321,17 +321,12 @@
 
         symbol = None
         states = []
-        iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
         if opts.get('children'):
             expr = 'children(%d) and merge() - %ld'
             revisions = repo.revs(expr, ctx.rev(), st.revs[1:])
             if len(revisions) > 0:
                 states.append('external-children')
 
-        if iscurrentrevision:
-            symbol = '@'
-            states.append('current')
-
         if ctx.orphan():
             symbol = '$'
             states.append('orphan')
@@ -344,6 +339,11 @@
             symbol = '$'
             states.append('phase divergent')
 
+        iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
+        if iscurrentrevision:
+            symbol = '@'
+            states.append('current')
+
         if not isentry:
             symbol = '^'
             # "base" is kind of a "ghost" entry
--- a/tests/test-evolve-topic.t	Sat Mar 09 13:13:53 2019 +0800
+++ b/tests/test-evolve-topic.t	Sun Mar 10 18:50:00 2019 +0800
@@ -126,7 +126,7 @@
   $ hg stack
   ### topic: foo
   ### target: default (branch)
-  s4$ add fff (current orphan)
+  s4@ add fff (current orphan)
   s3$ add eee (orphan)
   s2: add ddd
   s1: add ccc
@@ -268,7 +268,7 @@
   s5$ add jjj (orphan)
   s4$ add iii (orphan)
   s3$ add hhh (orphan)
-  s2$ add ggg (current orphan)
+  s2@ add ggg (current orphan)
   s1: add fff
   s0^ add eee (base)
 
--- a/tests/test-stack-branch.t	Sat Mar 09 13:13:53 2019 +0800
+++ b/tests/test-stack-branch.t	Sun Mar 10 18:50:00 2019 +0800
@@ -137,7 +137,7 @@
   $ hg stack
   ### target: foo (branch)
   s4$ c_f (orphan)
-  s3$ c_e (current orphan)
+  s3@ c_e (current orphan)
   s2: c_d
   s1: c_c
   s0^ c_b (base)
--- a/tests/test-topic-stack-complex.t	Sat Mar 09 13:13:53 2019 +0800
+++ b/tests/test-topic-stack-complex.t	Sun Mar 10 18:50:00 2019 +0800
@@ -163,7 +163,7 @@
   ### target: default (branch)
   s5$ Added e and f (content divergent)
   s3^ split2 (base)
-  s4$ Added e and f (content divergent current)
+  s4@ Added e and f (content divergent current)
   s3: split2
   s2: split1
   s1: Added a and b
--- a/tests/test-topic-stack.t	Sat Mar 09 13:13:53 2019 +0800
+++ b/tests/test-topic-stack.t	Sun Mar 10 18:50:00 2019 +0800
@@ -342,7 +342,7 @@
   ### topic: foo
   ### target: default (branch)
   s4$ c_f (orphan)
-  s3$ c_e (current orphan)
+  s3@ c_e (current orphan)
   s2: c_d
   s1: c_c
   s0^ c_b (base)
@@ -350,7 +350,7 @@
   [topic.stack.summary.topic|### topic: [topic.active|foo]]
   [topic.stack.summary.branches|### target: default (branch)]
   [topic.stack.index topic.stack.index.orphan|s4][topic.stack.state topic.stack.state.orphan|$] [topic.stack.desc topic.stack.desc.orphan|c_f][topic.stack.state topic.stack.state.orphan| (orphan)]
-  [topic.stack.index topic.stack.index.current topic.stack.index.orphan|s3][topic.stack.state topic.stack.state.current topic.stack.state.orphan|$] [topic.stack.desc topic.stack.desc.current topic.stack.desc.orphan|c_e][topic.stack.state topic.stack.state.current topic.stack.state.orphan| (current orphan)]
+  [topic.stack.index topic.stack.index.current topic.stack.index.orphan|s3][topic.stack.state topic.stack.state.current topic.stack.state.orphan|@] [topic.stack.desc topic.stack.desc.current topic.stack.desc.orphan|c_e][topic.stack.state topic.stack.state.current topic.stack.state.orphan| (current orphan)]
   [topic.stack.index topic.stack.index.clean|s2][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_d]
   [topic.stack.index topic.stack.index.clean|s1][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_c]
   [topic.stack.index topic.stack.index.base|s0][topic.stack.state topic.stack.state.base|^] [topic.stack.desc topic.stack.desc.base|c_b][topic.stack.state topic.stack.state.base| (base)]
@@ -783,7 +783,7 @@
     ^ c_H
   s2$ c_G (orphan)
     ^ c_F
-  s1$ c_D (current orphan)
+  s1@ c_D (current orphan)
   s0^ c_C (base orphan)
 
 more obsolescence
@@ -857,7 +857,7 @@
     ^ c_H
   s2$ c_G (orphan)
     ^ c_F
-  s1$ c_D (current orphan)
+  s1@ c_D (current orphan)
   s0^ c_C (base orphan)
 
 Test stack behavior with a split