How do I refresh and restart a Node application with Mercurial after clicking? (Equivalent to git post-receive in hg)

I've worked with Git to accomplish this before, but require Mercurial for another project. My Git recipe included post-receive hook

which looked like this:

git checkout -f


To update my application working directory every time I move to a remote repo on my server. Then I ran my application with node-supervisor : supervisor server.js

which will watch for file changes and restart Node after Git push / file change.

My question is the best way to achieve this with Mercurial. I've looked at hook changegroup

as a similar alternative, but I can't seem to find any examples of hooks. Thank!

Update: My implementation

In the answer and comment below, I went with a hook changegroup

. Specifically, in myrepo/.hg/hgrc

I used:

changegroup = hg update && /path/to/restart/


I went with a basic shell script to restart Node and install node-supervisor for above, for this project. It looks like this:

echo "Restarting Server" >> /logpath/server.log
sudo pkill -x node
sudo node server.js >> /logpath/server.log &
echo "Changegroup Hook Executed, Server Restarted"
exit 0


I only have one Node process running, so pkill (everything) works for me. I also run server.js directly from my repo directory.


source to share

1 answer

Try the "Hooks" in the "Red" Bean book. It is especially recommended to scroll down to the <Link> link , for example:


- after adding remote added changes



All Articles