stack: remove 'topic.' prefix from colors/labels
authorAnton Shestakov <av6@dwimlabs.net>
Tue, 28 May 2019 16:46:18 +0800
changeset 4658 89c1b739fabe
parent 4657 c24dabf8e848
child 4660 b62ed7c69561
stack: remove 'topic.' prefix from colors/labels Stack is related to topics, sure, but it is also good enough to be recognized on its own.
hgext3rd/topic/__init__.py
hgext3rd/topic/stack.py
tests/test-topic-stack.t
--- a/hgext3rd/topic/__init__.py	Sat May 18 16:56:47 2019 +0800
+++ b/hgext3rd/topic/__init__.py	Tue May 28 16:46:18 2019 +0800
@@ -164,22 +164,22 @@
               'topic.list.headcount.multiple': 'yellow',
               'topic.list.behindcount': 'cyan',
               'topic.list.behinderror': 'red',
-              'topic.stack.index': 'yellow',
-              'topic.stack.index.base': 'none dim',
-              'topic.stack.desc.base': 'none dim',
-              'topic.stack.shortnode.base': 'none dim',
-              'topic.stack.state.base': 'dim',
-              'topic.stack.state.clean': 'green',
-              'topic.stack.index.current': 'cyan',       # random pick
-              'topic.stack.state.current': 'cyan bold',  # random pick
-              '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',
+              'stack.index': 'yellow',
+              'stack.index.base': 'none dim',
+              'stack.desc.base': 'none dim',
+              'stack.shortnode.base': 'none dim',
+              'stack.state.base': 'dim',
+              'stack.state.clean': 'green',
+              'stack.index.current': 'cyan',       # random pick
+              'stack.state.current': 'cyan bold',  # random pick
+              'stack.desc.current': 'cyan',        # random pick
+              'stack.shortnode.current': 'cyan',   # random pick
+              'stack.state.orphan': 'red',
+              'stack.state.content-divergent': 'red',
+              'stack.state.phase-divergent': 'red',
+              'stack.summary.behindcount': 'cyan',
+              'stack.summary.behinderror': 'red',
+              'stack.summary.headcount.multiple': 'yellow',
               # default color to help log output and thg
               # (first pick I could think off, update as needed
               'log.topic': 'green_background',
--- a/hgext3rd/topic/stack.py	Sat May 18 16:56:47 2019 +0800
+++ b/hgext3rd/topic/stack.py	Tue May 28 16:46:18 2019 +0800
@@ -249,31 +249,31 @@
     if topic is not None:
         fm.plain(_('### topic: %s')
                  % ui.label(topic, label),
-                 label='topic.stack.summary.topic')
+                 label='stack.summary.topic')
 
         if 1 < len(st.heads):
             fm.plain(' (')
             fm.plain('%d heads' % len(st.heads),
-                     label='topic.stack.summary.headcount.multiple')
+                     label='stack.summary.headcount.multiple')
             fm.plain(')')
         fm.plain('\n')
     fm.plain(_('### target: %s (branch)')
              % '+'.join(st.branches), # XXX handle multi branches
-             label='topic.stack.summary.branches')
+             label='stack.summary.branches')
     if topic is None:
         if 1 < len(st.heads):
             fm.plain(' (')
             fm.plain('%d heads' % len(st.heads),
-                     label='topic.stack.summary.headcount.multiple')
+                     label='stack.summary.headcount.multiple')
             fm.plain(')')
     else:
         if st.behindcount == -1:
             fm.plain(', ')
             fm.plain('ambiguous rebase destination - %s' % st.behinderror,
-                     label='topic.stack.summary.behinderror')
+                     label='stack.summary.behinderror')
         elif st.behindcount:
             fm.plain(', ')
-            fm.plain('%d behind' % st.behindcount, label='topic.stack.summary.behindcount')
+            fm.plain('%d behind' % st.behindcount, label='stack.summary.behindcount')
     fm.plain('\n')
 
     if not st:
@@ -370,19 +370,19 @@
             fm.plain(' ' * spacewidth)
         else:
             fm.write('stack_index', '%s%%d' % prefix, idx,
-                     label=labelsgen('topic.stack.index', states))
+                     label=labelsgen('stack.index', states))
             if ui.verbose:
                 fm.write('node', '(%s)', fm.hexfunc(ctx.node()),
-                         label=labelsgen('topic.stack.shortnode', states))
+                         label=labelsgen('stack.shortnode', states))
             else:
                 fm.data(node=fm.hexfunc(ctx.node()))
         fm.write('symbol', '%s', symbol,
-                 label=labelsgen('topic.stack.state', states))
+                 label=labelsgen('stack.state', states))
         fm.plain(' ')
         fm.write('desc', '%s', ctx.description().splitlines()[0],
-                 label=labelsgen('topic.stack.desc', states))
+                 label=labelsgen('stack.desc', states))
         fm.condwrite(states != ['clean'] and idx is not None, 'state',
-                     ' (%s)', fm.formatlist(states, 'topic.stack.state'),
-                     label=labelsgen('topic.stack.state', states))
+                     ' (%s)', fm.formatlist(states, 'stack.state'),
+                     label=labelsgen('stack.state', states))
         fm.plain('\n')
     fm.end()
--- a/tests/test-topic-stack.t	Sat May 18 16:56:47 2019 +0800
+++ b/tests/test-topic-stack.t	Tue May 28 16:46:18 2019 +0800
@@ -359,13 +359,13 @@
   s1: c_c
   s0^ c_b (base)
   $ hg topic --list --color=debug
-  [topic.stack.summary.topic|### topic: [topic.active|foo]]
-  [topic.stack.summary.branches|### target: default (branch)]
-  [topic.stack.index topic.stack.index.orphan|s4][topic.stack.state topic.stack.state.orphan|$] [topic.stack.desc topic.stack.desc.orphan|c_f][topic.stack.state topic.stack.state.orphan| (orphan)]
-  [topic.stack.index topic.stack.index.current topic.stack.index.orphan|s3][topic.stack.state topic.stack.state.current topic.stack.state.orphan|@] [topic.stack.desc topic.stack.desc.current topic.stack.desc.orphan|c_e][topic.stack.state topic.stack.state.current topic.stack.state.orphan| (current orphan)]
-  [topic.stack.index topic.stack.index.clean|s2][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_d]
-  [topic.stack.index topic.stack.index.clean|s1][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_c]
-  [topic.stack.index topic.stack.index.base|s0][topic.stack.state topic.stack.state.base|^] [topic.stack.desc topic.stack.desc.base|c_b][topic.stack.state topic.stack.state.base| (base)]
+  [stack.summary.topic|### topic: [topic.active|foo]]
+  [stack.summary.branches|### target: default (branch)]
+  [stack.index stack.index.orphan|s4][stack.state stack.state.orphan|$] [stack.desc stack.desc.orphan|c_f][stack.state stack.state.orphan| (orphan)]
+  [stack.index stack.index.current stack.index.orphan|s3][stack.state stack.state.current stack.state.orphan|@] [stack.desc stack.desc.current stack.desc.orphan|c_e][stack.state stack.state.current stack.state.orphan| (current orphan)]
+  [stack.index stack.index.clean|s2][stack.state stack.state.clean|:] [stack.desc stack.desc.clean|c_d]
+  [stack.index stack.index.clean|s1][stack.state stack.state.clean|:] [stack.desc stack.desc.clean|c_c]
+  [stack.index stack.index.base|s0][stack.state stack.state.base|^] [stack.desc stack.desc.base|c_b][stack.state stack.state.base| (base)]
   $ hg up s2
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved