email notification setup

Matt Mackall mpm at selenic.com
Thu Sep 22 12:16:21 CDT 2005


On Thu, Sep 22, 2005 at 06:37:57PM +0200, Zbynek Winkler wrote:
> Zbynek Winkler wrote:
> 
> >Matt Mackall wrote:
> >
> >>>Does anyone have an email notificator ready for use with mercurial 
> >>>changegroup hook?
> >>>  
> >>
> >>Add this to .hg/hgrc:
> >>
> >>[hooks]
> >>commit = commithook
> >>
> >>And put this in your path:
> >>
> >>#!/bin/sh
> >>
> >>SUBJECT=`hg log -r $NODE | grep "^summary:" | cut -b 14-`
> >>hg log -vpr $NODE | mail -s "commit: $SUBJECT" commit-list at example.com
> >> 
> >>
> >Thanks. I replaced 'commit' with 'changegroup' since I want to set 
> >this up in a remote repo that nobody commits to.
> >
> >Where does $NODE come from? 
> 
> I've found it in the source. The commit hook is called with
> 
>        if not self.hook("commit", node=hex(n)):
>            return None
> 
> while changegroup
> 
>        if not self.hook("changegroup"):
>            return 1
> 
> Can we add the node id to the changegroup as well?
> Can we add a documentation about the params available for the hooks and 
> the way they are supplied?

Done. Push/pull now calls the changegroup hook with the first node and
the commit hook for every other one.

So with this:

[hooks]
changegroup = echo new group starting at $NODE
commit = echo new commit $NODE

we get:

$ hg pull ../hg
pulling from ../hg
searching for changes
adding changesets
adding manifests
adding file changes
added 10 changesets with 33 changes to 24 files
new group starting at 4f08da74cae86786731d6242639a0bbe0e8dc4c2
new commit 4f08da74cae86786731d6242639a0bbe0e8dc4c2
new commit 3b717f27ffea3fda40c708695ecbc935b050d5e0
new commit 2073e5a710081f0aea6bbe474b634bb0eb8fdc6f
new commit 332f225b835cc2ce8280af9adeafb0a9ac5f302a
new commit 7e8a55c9ee5cd46f5d41412d34762c31bb288c6d
new commit db8bebb08f8fe3455373c5975dc960d7b31691d4
new commit c9cf171f30dddd83e79d917cfc4e643b5be3105a
new commit 1cc7c0cbc30b39b224334416279a2e71546c6d7b
new commit d37a46859acdb887d709a428670b59d7d17cd051
new commit 32f6cae83db75e0d1d30e3b562d0615245db3354
(run 'hg update' to get a working copy)

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list