diff hgext3rd/topic/stack.py @ 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 5737e0680f10
children 42abd3bd30ee
line wrap: on
line diff
--- 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')