Tagged “mercurial”

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.

Mercurial (and others): How to read log message from STDIN

Published by cybso on

Use "tee" as editor:

$ (echo "Daily autocommit. Stats:"; hg diff | diffstat) | hg commit --config ui.editor=tee
Daily autocommit. Stats:
 b/bar |    1 +
 foo   |    1 +
 2 files changed, 2 insertions(+)</code>

$ hg log -v
Änderung:        1:bb6b896c1c95
Marke:           tip
Nutzer:          Roland
Datum:           Thu Apr 16 13:43:06 2015 +0200
Dateien:         bar foo
Beschreibung:
Daily autocommit. Stats:
 b/bar |    1 +
 foo   |    1 +
 2 files changed, 2 insertions(+)