Patchwork [STABLE] notify: fix fromauthor setting for 'incoming' hook type (issue4194)

login
register
mail settings
Submitter Bruce Cran
Date Oct. 5, 2015, 5:25 p.m.
Message ID <df6193e2344862558ca7.1444065904@cube.sdcorp.global.sandisk.com>
Download mbox | patch
Permalink /patch/10813/
State Accepted
Headers show

Comments

Bruce Cran - Oct. 5, 2015, 5:25 p.m.
# HG changeset patch
# User Bruce Cran <bruce.cran@gmail.com>
# Date 1444063396 21600
#      Mon Oct 05 10:43:16 2015 -0600
# Branch stable
# Node ID df6193e2344862558ca72c3f1fc23496b684406b
# Parent  93bfa9fc96e31f1cc5f444bdc2436966c665cf1f
notify: fix fromauthor setting for 'incoming' hook type (issue4194)

Set the author field in notification emails for the 'incoming' hook type
in addition to 'changegroup' and 'outgoing' types.
Pierre-Yves David - Oct. 6, 2015, 10:43 p.m.
On 10/05/2015 10:25 AM, Bruce Cran wrote:
> # HG changeset patch
> # User Bruce Cran <bruce.cran@gmail.com>
> # Date 1444063396 21600
> #      Mon Oct 05 10:43:16 2015 -0600
> # Branch stable
> # Node ID df6193e2344862558ca72c3f1fc23496b684406b
> # Parent  93bfa9fc96e31f1cc5f444bdc2436966c665cf1f
> notify: fix fromauthor setting for 'incoming' hook type (issue4194)

Seems legit, pushed to the clowncopter.

Patch

diff --git a/hgext/notify.py b/hgext/notify.py
--- a/hgext/notify.py
+++ b/hgext/notify.py
@@ -401,16 +401,18 @@  def hook(ui, repo, hooktype, node=None, 
     else:
         if not n.node(ctx):
             ui.popbuffer()
             ui.note(_('notify: suppressing notification for merge %d:%s\n') %
                     (ctx.rev(), ctx.hex()[:12]))
             return
         count += 1
         n.diff(ctx)
+        if not author:
+            author = ctx.user()
 
     data += ui.popbuffer()
     fromauthor = ui.config('notify', 'fromauthor')
     if author and fromauthor:
         data = '\n'.join(['From: %s' % author, data])
 
     if count:
         n.send(ctx, count, data)