stack: show content and phase divergent state and symbol
Replacing ' ' with '-' is just for color labels.
--- a/hgext3rd/topic/__init__.py Sat Mar 09 12:54:00 2019 +0800
+++ b/hgext3rd/topic/__init__.py Sat Mar 09 13:13:53 2019 +0800
@@ -168,6 +168,8 @@
'topic.stack.desc.current': 'cyan', # random pick
'topic.stack.shortnode.current': 'cyan', # random pick
'topic.stack.state.orphan': 'red',
+ 'topic.stack.state.content-divergent': 'red',
+ 'topic.stack.state.phase-divergent': 'red',
'topic.stack.summary.behindcount': 'cyan',
'topic.stack.summary.behinderror': 'red',
'topic.stack.summary.headcount.multiple': 'yellow',
--- a/hgext3rd/topic/stack.py Sat Mar 09 12:54:00 2019 +0800
+++ b/hgext3rd/topic/stack.py Sat Mar 09 13:13:53 2019 +0800
@@ -219,7 +219,7 @@
""" Takes a label prefix and a list of suffixes. Returns a string of the prefix
formatted with each suffix separated with a space.
"""
- return ' '.join(prefix % suffix for suffix in labelssuffix)
+ return ' '.join(prefix % suffix.replace(' ', '-') for suffix in labelssuffix)
def showstack(ui, repo, branch=None, topic=None, opts=None):
if opts is None:
@@ -336,6 +336,14 @@
symbol = '$'
states.append('orphan')
+ if ctx.contentdivergent():
+ symbol = '$'
+ states.append('content divergent')
+
+ if ctx.phasedivergent():
+ symbol = '$'
+ states.append('phase divergent')
+
if not isentry:
symbol = '^'
# "base" is kind of a "ghost" entry
--- a/tests/test-topic-stack-complex.t Sat Mar 09 12:54:00 2019 +0800
+++ b/tests/test-topic-stack-complex.t Sat Mar 09 13:13:53 2019 +0800
@@ -161,9 +161,9 @@
$ hg stack
### topic: foo (2 heads)
### target: default (branch)
- s5: Added e and f
+ s5$ Added e and f (content divergent)
s3^ split2 (base)
- s4@ Added e and f (current)
+ s4$ Added e and f (content divergent current)
s3: split2
s2: split1
s1: Added a and b