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

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(+)

$ hg log -v
Änderung:        1:bb6b896c1c95
Marke:           tip
Nutzer:          Roland Tapken
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(+)