[PATCH] patchbomb: add label and color to the confirm output

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Nov 4 08:09:39 CST 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1415108313 0
#      Tue Nov 04 13:38:33 2014 +0000
# Node ID 16d4cdda0525f220780f303c9297e898fc022363
# Parent  30e0dcd7c5ffd99fb9c2474e9d73ca01a7d292fa
patchbomb: add label and color to the confirm output

The current confirm output is mostly as wall of text. This make it hard to
actually check something for people with lazy eyes. We use labels and colors to
make it more joyful (and get the patches summary to standout).
The color have been arbitrarily choosen. They can be changed later if someone
have a more scientific choice.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -299,10 +299,15 @@ except ImportError:
            'diffstat.deleted': 'red',
            'diffstat.inserted': 'green',
            'histedit.remaining': 'red bold',
            'ui.prompt': 'yellow',
            'log.changeset': 'yellow',
+           'patchbomb.finalsummary': '',
+           'patchbomb.from': 'magenta',
+           'patchbomb.to': 'cyan',
+           'patchbomb.subject': 'green',
+           'patchbomb.diffstats': '',
            'rebase.rebased': 'blue',
            'rebase.remaining': 'red bold',
            'resolve.resolved': 'green bold',
            'resolve.unresolved': 'red bold',
            'shelve.age': 'cyan',
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -481,18 +481,18 @@ def patchbomb(ui, repo, *revs, **opts):
     cc = getaddrs('Cc', ask=True, default='') or []
     bcc = getaddrs('Bcc') or []
     replyto = getaddrs('Reply-To')
 
     if opts.get('diffstat') or opts.get('confirm'):
-        ui.write(_('\nFinal summary:\n\n'))
-        ui.write(('From: %s\n' % sender))
+        ui.write(_('\nFinal summary:\n\n'), label='patchbomb.finalsummary')
+        ui.write(('From: %s\n' % sender), label='patchbomb.from')
         for addr in showaddrs:
-            ui.write('%s\n' % addr)
+            ui.write('%s\n' % addr, label='patchbomb.to')
         for m, subj, ds in msgs:
-            ui.write(('Subject: %s\n' % subj))
+            ui.write(('Subject: %s\n' % subj), label='patchbomb.subject')
             if ds:
-                ui.write(ds)
+                ui.write(ds, label='patchbomb.diffstats')
         ui.write('\n')
         if ui.promptchoice(_('are you sure you want to send (yn)?'
                              '$$ &Yes $$ &No')):
             raise util.Abort(_('patchbomb canceled'))
 


More information about the Mercurial-devel mailing list