views:

56

answers:

1

I have a server which serves a "central" Mercurial repository; the team clones it and pushes their changes up to it via ssh. Hudson is installed on the same server (RHEL 5.5). I wish to trigger a Hudson build whenever anyone pushes to the central Mercurial repository. I also wish to send a notification email upon a push.

In ProjectName/.hg/.hgrc there is the following:

[hooks]
changegroup.hudson = wget http://Server.Name:8080//job/Project_Name/builds?delay=0sec >&2

If I use putty to ssh to this server and then issue the wget command, a build is successfully triggered, so I don't think it's a permissions issue.

Another hook is:

changegroup.notify = /the/path/.hg/hooks/notify

where notify is:

dest='comma separated list of email addresses'
repo="path/to/repository/"
subject="New changesets in $repo"

hg glog -l 10 -r $HG_NODE: | mail -s "$subject" $dest

When I run ./notify directly from the shell, the mail is sent correctly when I am in the central repository's path; if I execute notify from my home directory, the repository is not found and I get an empty email, but at least I get an email. I assume these hooks are just not being run.

What could be getting in the way? What should I check?

+2  A: 

Run cd ProjectName; hg showconfig|grep hooks.

I bet your don't see your hooks, if this is exactly what you have:

In ProjectName/.hg/.hgrc there is the following:

Repository-wide hgrc is .hg/hgrc without dot.

Geoffrey Zheng
Beautiful! You nailed it. Thank you.
jasper77
Now, whenever I do "hg incoming" from in my personal clone, I get a message saying, "Not trusting file /path/hgrc from untrusted user me, group me". I've added a "[trusted]" section in my personal local account, permitting all users and all groups, yet I still get this message. AND the hooks still do not work.
jasper77
I can't edit the previous comment so: Added [trusted] section to repository-wide hgrc and .hgrc, and still have this problem.
jasper77
Followed advice here: http://mercurial.selenic.com/wiki/Trust by adding "trusted.users=root" to /etc/mercurial/hgrc and changing ownership of .hg/hgrc to root-root, and now when I do "hg incoming" from my personal clone, it says it's not trusting user root, group root.
jasper77
You should ask a new question for the trust problems. Be very clear about what exactly you're trying to from where to where as whom, what's the permission for the repositories, what's the trust settings for involved users, etc.
Geoffrey Zheng