--- a/.hgeditor Thu Dec 22 13:40:29 2016 +0800
+++ b/.hgeditor Thu Dec 22 13:41:34 2016 +0800
-# This is an example of using HGEDITOR to create of diff to review the
-# changes while commiting.
- grep '^HG: \(changed\|added\|removed\)' "$1" | cut -d ' ' -f 3- | while read changed; do
- "$HG" diff "$changed" >> "$HGTMP/diff"
+LINE=$(fgrep 'HG: --- 8< ---' -nm1 "$1" | cut -d: -f1)
+ head -n "$(( LINE - 1 ))" "$1" > "$HGTMP/msg"
+ tail -n +"$(( LINE + 1 ))" "$1" | sed -e 's/^HG: //g' > "$HGTMP/diff"
+ cat "$1" > "$HGTMP/msg"
MD5=$(which md5sum 2>/dev/null) || \
MD5=$(which md5 2>/dev/null)
--- a/.hgrc Thu Dec 22 13:40:29 2016 +0800
+++ b/.hgrc Thu Dec 22 13:41:34 2016 +0800
+ HG: Enter commit message. Lines beginning with 'HG:' are removed.
+ HG: user: {author}\n{ifeq(p2rev, "-1", "",
+ }HG: branch '{branch}'\n{if(activebookmark,
+ "HG: bookmark '{activebookmark}'\n") }{subrepos %
+ "HG: subrepo {subrepo}\n" }{file_adds %
+ "HG: added {file}\n" }{file_mods %
+ "HG: changed {file}\n" }{file_dels %
+ "HG: removed {file}\n" }{if(files, "",
+ "HG: no files changed\n")
+ {splitlines(diff()) % 'HG: {line}\n'}