From patchwork Tue Nov 4 14:09:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: patchbomb: add label and color to the confirm output From: Pierre-Yves David X-Patchwork-Id: 6558 Message-Id: <16d4cdda0525f220780f.1415110179@marginatus.alto.octopoid.net> To: mercurial-devel@selenic.com Cc: Pierre-Yves David Date: Tue, 04 Nov 2014 14:09:39 +0000 # HG changeset patch # User Pierre-Yves David # 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'))