changeset 30721:4ab19763d71c

summary: use ui.label and join to write evolution troubles Follow-up on 7b526670f540 to avoid a convoluted loop.
author Denis Laxalde <denis@laxalde.org>
date Sat, 07 Jan 2017 12:24:15 +0100
parents 32f160ceb99d
children 117e15c30e6c
files mercurial/commands.py
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Jan 07 12:07:56 2017 +0100
+++ b/mercurial/commands.py	Sat Jan 07 12:24:15 2017 +0100
@@ -5992,14 +5992,10 @@
             else:
                 ui.write(_(' (no revision checked out)'))
         if p.troubled():
-            ui.write(' (')
-            troubles = p.troubles()
-            for idx, trouble in enumerate(troubles, 1):
-                ui.write(trouble,
-                         label='trouble.%s' % trouble)
-                if idx < len(troubles):
-                    ui.write(', ')
-            ui.write(')')
+            ui.write(' ('
+                     + ', '.join(ui.label(trouble, 'trouble.%s' % trouble)
+                                 for trouble in p.troubles())
+                     + ')')
         ui.write('\n')
         if p.description():
             ui.status(' ' + p.description().splitlines()[0].strip() + '\n',