hgext3rd/topic/stack.py
branchmercurial-4.8
changeset 4356 a71f2271ed76
parent 4285 69fb9e41ce2b
child 4429 e10ebc58926e
--- a/hgext3rd/topic/stack.py	Tue Jan 22 10:43:44 2019 -0500
+++ b/hgext3rd/topic/stack.py	Tue Jan 22 10:46:02 2019 -0500
@@ -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()