[PATCH] notify: permit suppression of merge changeset notification

Matt Mackall mpm at selenic.com
Tue Sep 22 14:09:02 CDT 2009


On Tue, 2009-09-22 at 18:49 +0000, David Champion wrote:
> # HG changeset patch
> # User David Champion <dgc at uchicago.edu>
> # Date 1253645316 18000
> # Node ID 936364a26b17b03e9a2a12d92a523523cdf6e368
> # Parent  c564dbb2a6d5394c995c1ae93943a16253e7b1e5
> notify: permit suppression of merge changeset notification
> 
> In some environments merges occur regularly but with no conflicts, and
> committers find merge notifications more of a bother than a help.
> 
> When using the notify extension as an incoming hook, and by setting
> merge=False in [notify], merge notifications are suppressed.
> 
> diff -r c564dbb2a6d5 -r 936364a26b17 hgext/notify.py
> --- a/hgext/notify.py	Thu Sep 17 21:52:08 2009 +0200
> +++ b/hgext/notify.py	Tue Sep 22 13:48:36 2009 -0500
> @@ -43,6 +43,7 @@
>    diffstat = True        # add a diffstat before the diff content
>    sources = serve        # notify if source of incoming changes in this list
>                           # (serve == ssh or http, push, pull, bundle)
> +  merge = False          # send notification for merges (default True)
>    [email]
>    from = user at host.com   # email address to send as if none given
>    [web]
> @@ -111,6 +112,7 @@
>          self.test = self.ui.configbool('notify', 'test', True)
>          self.charsets = mail._charsets(self.ui)
>          self.subs = self.subscribers()
> +        self.merge = self.ui.configbool('notify', 'merge', True)
>  
>          mapfile = self.ui.config('notify', 'style')
>          template = (self.ui.config('notify', hooktype) or
> @@ -290,6 +292,11 @@
>              n.node(repo[rev])
>          n.diff(ctx, repo['tip'])
>      else:
> +        if not n.merge and len(ctx.parents()) > 1:
> +            ui.popbuffer()
> +            ui.status(_('notify: suppressing notification for merge %d:%s\n') %
> +                      (ctx.rev(), ctx.hex()[:12]))
> +            return

This looks good, but this should perhaps be a ui.note? Also, it seems we
should suppress merge csets inside the changegroup branch as well? So
perhaps this logic should be pushed into notifier.node?

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list