Mercurial > evolve
diff hgext3rd/topic/stack.py @ 4285:69fb9e41ce2b
stack: add a --children flag to stack
If a commit in the stack has been merged outside the current topic, show a trailing status of (external-children)
author | James Reynolds <jreynolds@backstage.com> |
---|---|
date | Fri, 21 Sep 2018 11:44:34 -0400 |
parents | fb4801478d5d |
children | e10ebc58926e |
line wrap: on
line diff
--- 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()