[PATCH] notify extension: send changesets on outgoing hook

Ingo Breßler dev at ingobressler.net
Tue Jun 14 06:35:44 CDT 2011


New patch including doc note, see below.

Am 13.06.2011 21:20, schrieb Matt Mackall:
> On Sun, 2011-06-12 at 21:11 +0200, Ingo Breßler wrote:
>> Hello,
>>
>> this patch is supposed to enable sending a single notification email on
>> the client side after pushing a group of changesets to a central
>> repository (server).
>>
>> Similar to the 'changegroup' hooktype which is designed for the server
>> side (sending an email after receiving changesets by push from clients).
>>
>> The use case is to notify/sync external services (website,blog,etc) on a
>> personal/developer scope and not on the overall repository scope.
>>
>> This is just a fix. Perhaps, somebody with a better understanding of the
>> internals knows a better or more general way to solve this.
> 
> This looks fine, but it needs a doc note.

# HG changeset patch
# User Ingo Bressler <dev at ingobressler.net>
# Date 1308050965 -7200
# Node ID 8c3700d59acc32e10f7578d895be5a73fa582977
# Parent  6e631c24c6d9ba94c482c0b3ca6946aa4fcb8300
notify: send changesets on 'outgoing' hook, updated doc

diff -r 6e631c24c6d9 -r 8c3700d59acc hgext/notify.py
--- a/hgext/notify.py	Mon Jun 13 16:25:18 2011 -0500
+++ b/hgext/notify.py	Tue Jun 14 13:29:25 2011 +0200
@@ -21,6 +21,8 @@
   incoming.notify = python:hgext.notify.hook
   # batch emails when many changesets incoming at one time
   changegroup.notify = python:hgext.notify.hook
+  # batch emails when many changesets outgoing at one time (client side)
+  outgoing.notify = python:hgext.notify.hook

   [notify]
   # config items go here
@@ -37,7 +39,8 @@
   style = ...            # style file to use when formatting email
   template = ...         # template to use when formatting email
   incoming = ...         # template to use when run as incoming hook
-  changegroup = ...      # template when run as changegroup hook
+  outgoing = ...         # template to use when run as outgoing hook
+  changegroup = ...      # template to use when run as changegroup hook
   maxdiff = 300          # max lines of diffs to include (0=none, -1=all)
   maxsubject = 67        # truncate subject line longer than this
   diffstat = True        # add a diffstat before the diff content
@@ -290,7 +293,7 @@
     ui.pushbuffer()
     data = ''
     count = 0
-    if hooktype == 'changegroup':
+    if hooktype == 'changegroup' or hooktype == 'outgoing':
         start, end = ctx.rev(), len(repo)
         for rev in xrange(start, end):
             if n.node(repo[rev]):


More information about the Mercurial-devel mailing list