stack: show content and phase divergent state and symbol
authorAnton Shestakov <av6@dwimlabs.net>
Sat, 09 Mar 2019 13:13:53 +0800
changeset 4435 7915aef191ff
parent 4434 432f2155d106
child 4436 ef155f624670
stack: show content and phase divergent state and symbol Replacing ' ' with '-' is just for color labels.
hgext3rd/topic/__init__.py
hgext3rd/topic/stack.py
tests/test-topic-stack-complex.t
--- 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