diff hgext3rd/topic/stack.py @ 4434:432f2155d106

stack: handle external-children just like other states This also fixes color labels: previously when external-children was combined with another state, --color=debug would show something like: [topic.stack.index topic.stack.index.current - external-children|s4] Now there is a separate label for each state.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 09 Mar 2019 12:54:00 +0800
parents a19d8196b0c9
children 7915aef191ff
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Thu Mar 07 22:50:56 2019 +0800
+++ b/hgext3rd/topic/stack.py	Sat Mar 09 12:54:00 2019 +0800
@@ -321,27 +321,20 @@
 
         symbol = None
         states = []
-        msg = ''
         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:
-                msg = 'external-children'
+                states.append('external-children')
 
         if iscurrentrevision:
             symbol = '@'
-            if msg:
-                states.append('current - ' + msg)
-            else:
-                states.append('current')
+            states.append('current')
 
         if ctx.orphan():
             symbol = '$'
-            if msg:
-                states.append('orphan - ' + msg)
-            else:
-                states.append('orphan')
+            states.append('orphan')
 
         if not isentry:
             symbol = '^'
@@ -351,10 +344,9 @@
         # none of the above if statments get executed
         if not symbol:
             symbol = ':'
-            if msg:
-                states.append(msg)
-            else:
-                states.append('clean')
+
+        if not states:
+            states.append('clean')
 
         states.sort()