diff hgext3rd/topic/stack.py @ 2670:f5d52fa1cd55

topic: move the heads data to the branch line when appropriates The topic line is dropped as it is quite confusing.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 28 Jun 2017 01:53:21 +0200
parents b933a8068c17
children 90e11985d0cc
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Wed Jun 28 02:45:57 2017 +0200
+++ b/hgext3rd/topic/stack.py	Wed Jun 28 01:53:21 2017 +0200
@@ -55,24 +55,33 @@
         label = 'topic.active'
 
     data = stackdata(repo, branch=branch, topic=topic)
-    fm.plain(_('### topic: %s') % ui.label(topic, label),
-             label='topic.stack.summary.topic')
+    if topic is not None:
+        fm.plain(_('### topic: %s')
+                 % ui.label(topic, label),
+                 label='topic.stack.summary.topic')
 
-    if 1 < data['headcount']:
-        fm.plain(' (')
-        fm.plain('%d heads' % data['headcount'],
-                 label='topic.stack.summary.headcount.multiple')
-        fm.plain(')')
-    fm.plain('\n')
+        if 1 < data['headcount']:
+            fm.plain(' (')
+            fm.plain('%d heads' % data['headcount'],
+                     label='topic.stack.summary.headcount.multiple')
+            fm.plain(')')
+        fm.plain('\n')
     fm.plain(_('### branch: %s')
              % '+'.join(data['branches']), # XXX handle multi branches
              label='topic.stack.summary.branches')
-    if data['behindcount'] == -1:
-        fm.plain(', ')
-        fm.plain('ambigious rebase destination', label='topic.stack.summary.behinderror')
-    elif data['behindcount']:
-        fm.plain(', ')
-        fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount')
+    if topic is None:
+        if 1 < data['headcount']:
+            fm.plain(' (')
+            fm.plain('%d heads' % data['headcount'],
+                     label='topic.stack.summary.headcount.multiple')
+            fm.plain(')')
+    else:
+        if data['behindcount'] == -1:
+            fm.plain(', ')
+            fm.plain('ambigious rebase destination', label='topic.stack.summary.behinderror')
+        elif data['behindcount']:
+            fm.plain(', ')
+            fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount')
     fm.plain('\n')
 
     for idx, r in enumerate(getstack(repo, branch=branch, topic=topic), 1):