hgext3rd/topic/__init__.py
changeset 1987 d427fd97c9d5
parent 1985 03d6b685c16a
child 1988 9a5d797d25be
equal deleted inserted replaced
1986:042356d5ba59 1987:d427fd97c9d5
   278     return stack.showstack(ui, repo, topic, opts)
   278     return stack.showstack(ui, repo, topic, opts)
   279 
   279 
   280 def _listtopics(ui, repo, opts):
   280 def _listtopics(ui, repo, opts):
   281     fm = ui.formatter('bookmarks', opts)
   281     fm = ui.formatter('bookmarks', opts)
   282     activetopic = repo.currenttopic
   282     activetopic = repo.currenttopic
       
   283     namemask = '%s'
       
   284     if repo.topics and ui.verbose:
       
   285         maxwidth = max(len(t) for t in repo.topics)
       
   286         namemask = '%%-%is' % maxwidth
   283     for topic in sorted(repo.topics):
   287     for topic in sorted(repo.topics):
   284         fm.startitem()
   288         fm.startitem()
   285         marker = ' '
   289         marker = ' '
   286         label = 'topic'
   290         label = 'topic'
   287         active = (topic == activetopic)
   291         active = (topic == activetopic)
   289             marker = '*'
   293             marker = '*'
   290             label = 'topic.active'
   294             label = 'topic.active'
   291         if not ui.quiet:
   295         if not ui.quiet:
   292             # registering the active data is made explicitly later
   296             # registering the active data is made explicitly later
   293             fm.plain(' %s ' % marker, label=label)
   297             fm.plain(' %s ' % marker, label=label)
   294         fm.write('topic', '%s', topic, label=label)
   298         fm.write('topic', namemask, topic, label=label)
   295         fm.data(active=active)
   299         fm.data(active=active)
   296         if ui.verbose:
   300         if ui.verbose:
   297             # XXX we should include the data even when not verbose
   301             # XXX we should include the data even when not verbose
   298             data = stack.stackdata(repo, topic)
   302             data = stack.stackdata(repo, topic)
   299             fm.plain('\t(')
   303             fm.plain(' (')
   300             fm.write('changesetcount', '%d changesets', data['changesetcount'],
   304             fm.write('changesetcount', '%d changesets', data['changesetcount'],
   301                      label='topic.list.changesetcount')
   305                      label='topic.list.changesetcount')
   302             if data['troubledcount']:
   306             if data['troubledcount']:
   303                 fm.plain(', ')
   307                 fm.plain(', ')
   304                 fm.write('troubledcount', '%d troubled',
   308                 fm.write('troubledcount', '%d troubled',