changeset 2626:bc36a608e9e4

stack: show unstable state for the current revision if it is one (issue5553) Before this patch if the current revision is unstable, hg stack does not show the unstable state. This patch fixes that by showing both current and unstable state for the current revision if that's unstable.
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 19 Jun 2017 02:50:35 +0530
parents 8f2901f4749e
children 42abd3bd30ee
files README hgext3rd/topic/stack.py tests/test-topic-stack.t
diffstat 3 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/README	Mon Jun 19 02:44:19 2017 +0530
+++ b/README	Mon Jun 19 02:50:35 2017 +0530
@@ -124,6 +124,7 @@
 6.5.0 - in progress
 -------------------
 
+ - stack: also show the unstable status for the current changeset (issue5553)
  - topic: fix issue5441 in the linear case,
 
 6.4.0 -- 2017-06-16
--- a/hgext3rd/topic/stack.py	Mon Jun 19 02:44:19 2017 +0530
+++ b/hgext3rd/topic/stack.py	Mon Jun 19 02:50:35 2017 +0530
@@ -69,19 +69,22 @@
         states = []
         iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
 
-        if iscurrentrevision:
-            states.append('current')
-
         if not isentry:
             symbol = '^'
             # "base" is kind of a "ghost" entry
             # skip other label for them (no current, no unstable)
             states = ['base']
-        elif iscurrentrevision:
-            symbol = '@'
         elif repo.revs('%d and unstable()', ctx.rev()):
+            # current revision can be unstable also, so in that case show both
+            # the states and the symbol '@' (issue5553)
+            if iscurrentrevision:
+                states.append('current')
+                symbol = '@'
             symbol = '$'
             states.append('unstable')
+        elif iscurrentrevision:
+            states.append('current')
+            symbol = '@'
         else:
             symbol = ':'
             states.append('clean')
--- a/tests/test-topic-stack.t	Mon Jun 19 02:44:19 2017 +0530
+++ b/tests/test-topic-stack.t	Mon Jun 19 02:50:35 2017 +0530
@@ -188,7 +188,7 @@
   ### topic: foo
   ### branch: default
   t4$ c_f (unstable)
-  t3@ c_e (current)
+  t3$ c_e (current unstable)
   t2: c_d
   t1: c_c
     ^ c_b
@@ -196,7 +196,7 @@
   [topic.stack.summary.topic|### topic: [topic.active|foo]]
   [topic.stack.summary.branches|### branch: default]
   [topic.stack.index topic.stack.index.unstable|t4][topic.stack.state topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.unstable|c_f][topic.stack.state topic.stack.state.unstable| (unstable)]
-  [topic.stack.index topic.stack.index.current|t3][topic.stack.state topic.stack.state.current|@] [topic.stack.desc topic.stack.desc.current|c_e][topic.stack.state topic.stack.state.current| (current)]
+  [topic.stack.index topic.stack.index.current topic.stack.index.unstable|t3][topic.stack.state topic.stack.state.current topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.current topic.stack.desc.unstable|c_e][topic.stack.state topic.stack.state.current topic.stack.state.unstable| (current unstable)]
   [topic.stack.index topic.stack.index.clean|t2][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_d]
   [topic.stack.index topic.stack.index.clean|t1][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_c]
     [topic.stack.state topic.stack.state.base|^] [topic.stack.desc topic.stack.desc.base|c_b]