hgext3rd/topic/__init__.py
changeset 1987 d427fd97c9d5
parent 1985 03d6b685c16a
child 1988 9a5d797d25be
--- a/hgext3rd/topic/__init__.py	Tue Aug 16 15:32:54 2016 +0200
+++ b/hgext3rd/topic/__init__.py	Tue Aug 16 15:43:06 2016 +0200
@@ -280,6 +280,10 @@
 def _listtopics(ui, repo, opts):
     fm = ui.formatter('bookmarks', opts)
     activetopic = repo.currenttopic
+    namemask = '%s'
+    if repo.topics and ui.verbose:
+        maxwidth = max(len(t) for t in repo.topics)
+        namemask = '%%-%is' % maxwidth
     for topic in sorted(repo.topics):
         fm.startitem()
         marker = ' '
@@ -291,12 +295,12 @@
         if not ui.quiet:
             # registering the active data is made explicitly later
             fm.plain(' %s ' % marker, label=label)
-        fm.write('topic', '%s', topic, label=label)
+        fm.write('topic', namemask, topic, label=label)
         fm.data(active=active)
         if ui.verbose:
             # XXX we should include the data even when not verbose
             data = stack.stackdata(repo, topic)
-            fm.plain('\t(')
+            fm.plain(' (')
             fm.write('changesetcount', '%d changesets', data['changesetcount'],
                      label='topic.list.changesetcount')
             if data['troubledcount']: