hgext3rd/topic/stack.py
changeset 4285 69fb9e41ce2b
parent 4067 fb4801478d5d
child 4429 e10ebc58926e
--- a/hgext3rd/topic/stack.py	Sun Dec 02 16:52:14 2018 +0100
+++ b/hgext3rd/topic/stack.py	Fri Sep 21 11:44:34 2018 -0400
@@ -329,15 +329,32 @@
 
         symbol = None
         states = []
+        msg = ''
         iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
+        if opts.get('children'):
+            if branch:
+                t_msg = '-branch("%s")' % branch
+            if topic:
+                t_msg = '-topic("%s")' % topic
+            rev_msg = 'children(%s) and merge() %s'
+            revisions = repo.revs(rev_msg % (ctx.rev(), t_msg))
+            len_rev = len(revisions)
+            if len_rev > 0:
+                msg = 'external-children'
 
         if iscurrentrevision:
-            states.append('current')
             symbol = '@'
+            if msg:
+                states.append('current - ' + msg)
+            else:
+                states.append('current')
 
         if ctx.orphan():
             symbol = '$'
-            states.append('unstable')
+            if msg:
+                states.append('unstable - ' + msg)
+            else:
+                states.append('unstable')
 
         if not isentry:
             symbol = '^'
@@ -347,7 +364,10 @@
         # none of the above if statments get executed
         if not symbol:
             symbol = ':'
-            states.append('clean')
+            if msg:
+                states.append(msg)
+            else:
+                states.append('clean')
 
         states.sort()