This should be a very simple thing to have run, but for some reason it won't work with my Mercurial repository. All I want is for the remote repo to automatically run hg update
whenever someone pushes to it. So I have this in my .hg/hgrc file:
[hook]
changegroup = hg update
Simple, right? But for some reason, this never executes. I also tried writing a shell script that did this. .hg/hgrc looked like this:
[hooks]
changegroup = /home/marc/bin/hg-update
and hg-update looked like this:
#!/bin/sh
hg help >> /home/marc/works.txt;
hg update >> /home/marc/works.txt;
exit 0;
But again, this doesn't update. The contents of hg help
are written out to works.txt
, but nothing is written out for hg update
. Is there something obvious I'm missing here? This has been plaguing me for days and I just can't seem to get it to work.
Update
Okay so again, using the -v
switch on the command line from my workstation pushing to the remote repo doesn't print any verbose messages even when I have those echo
lines in .hg/hgrc
. However, when I do a push from a clone of the repo on the same filesystem (I'm logged in via SSH), this is what I get:
bash-3.00$ hg -v push ../test-repo/ pushing to ../test-repo/ searching for changes 1 changesets found running hook prechangegroup: echo "Remote repo is at `hg tip -q`" echo "Remote repo wdir is at `hg parents -q`" Remote repo is at 821:1f2656753c98 Remote repo wdir is at 821:1f2656753c98 adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files running hook changegroup: echo "Updating.... `hg update -v`" echo "Remote repo is at `hg tip -q`" echo "Remote repo wdir is at `hg parents -q`" Updating.... resolving manifests getting license.txt 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Remote repo is at 822:389a6c7276c6 Remote repo wdir is at 822:389a6c7276c6
So it works, but again only when I push from the same filesystem. It doesn't work if I try pushing to the repo from another workstation over the network.