Patchwork patchbomb: add label and color to the confirm output

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 4, 2014, 2:09 p.m.
Message ID <16d4cdda0525f220780f.1415110179@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6558/
State Accepted
Headers show

Comments

Pierre-Yves David - Nov. 4, 2014, 2:09 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Augie Fackler - Nov. 4, 2014, 5:37 p.m.
On Tue, Nov 04, 2014 at 02:09:39PM +0000, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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

Queued, thanks.

>
> 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'))
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

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'))