Auto-Update Mercurial production repository
Published by cybso on
Create a branch production
which contains all changes that should went onto the production server:
$ hg branch production && hg commit -m "Added new branch 'production'"
Clone repo to remote:
$ hg clone . ssh://user@host//path/to/repository
On the server, switch to production branch:
$ hg update production
Now add the following hook into the .hg/hgrc
:
[hooks]
# If current branch is out of date, update and refresh
changegroup = (LANG=C hg summary | grep -q 'update: (current)' || (hg update && mvn clean compile install && systemctl )) >&2
This example uses Maven to rebuild the src into the target directory if any update in the production branch appears.