Source

hg-review-mutt-test / hg-commit

Full commit
#!/bin/bash

MUTTDIR=$(dirname $0)

$MUTTDIR/check_sec.sh

lrev=$(hg log --limit 1 --template '{rev}' ChangeLog)
trev=$(hg tip --template '{rev'})
if [ $lrev = $trev ]
then
  exec hg commit "$@"
fi

# Include ChangeLog if given any explicit file names
i=0
while [[ $i -lt $# ]]
do
  i=$((i+1))
  case "${!i}" in
    # no-argument options
    -A) continue ;;
    # one-argument options
    -?) i=$((i+1)); continue ;;
    # one-argument options with no space
    -*) continue ;;
    *) cl=ChangeLog ;;
  esac
done

{
  hg log --style=./hg-changelog-map -r tip:$lrev
  hg cat ChangeLog
} > ChangeLog
${VISUAL:-${EDITOR-:vi}} ChangeLog

hg commit "$@" $cl