Let Jenkins build project from a Mercurial commit

  1. Select the Poll SCM option under Build Triggers.
  2. Make sure that schedule form is empty.

You should be creating in the .hg directory, /home/user/mercurial/.hg/hgrc and add hooks as:

[hooks]
commit.jenkins = wget -q http://localhost:8080/mercurial/notifyCommit?url=file:///home/user/mercurial > /dev/null
incoming.jenkins = wget -q http://localhost:8080/mercurial/notifyCommit?url=file:///home/user/mercurial > /dev/null

You should make sure that

  1. Your Jenkins project doesn't poll

  2. You use the proper notifyCommit URLs for your Mercurial hooks: https://wiki.jenkins-ci.org/display/JENKINS/Mercurial+Plugin