summary: use ui.label and join to write evolution troubles
authorDenis Laxalde <denis@laxalde.org>
Sat, 07 Jan 2017 12:24:15 +0100
changeset 30721 4ab19763d71c
parent 30720 32f160ceb99d
child 30722 117e15c30e6c
summary: use ui.label and join to write evolution troubles Follow-up on 7b526670f540 to avoid a convoluted loop.
mercurial/commands.py
--- 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',