From: Brendan Cully Date: Tue, 6 Mar 2007 23:43:21 +0000 (-0800) Subject: Make hg commit less clever X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d12c8fcd955d3eb56bc1df405d1975c314d5ab9d;p=neomutt Make hg commit less clever --- diff --git a/hg-commit b/hg-commit index be86a33e1..220272bba 100755 --- a/hg-commit +++ b/hg-commit @@ -1,30 +1,31 @@ #!/bin/bash -hg commit "$@" - lrev=$(hg log --limit 1 --template '{rev}' ChangeLog) trev=$(hg tip --template '{rev'}) -if [ $lrev = $trev ]; then exit 0; fi - -declare -a nopts +if [ $lrev = $trev ] +then + exec hg commit "$@" +fi -while [ $# -gt 0 ] +# Include ChangeLog if given any explicit file names +i=0 +while [[ $i -lt $# ]] do - case "$1" in - -m|-l) shift ;; - -*) nopts[${#nopts[*]}]="$1" ;; - # Include ChangeLog if given any explicit file names - *) nopts[${#nopts[*]}]="$1"; cl=ChangeLog ;; + 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 - shift done -clog=$(hg tip --template '{desc}') - { hg log --style=./hg-changelog-map -r tip:$lrev hg cat ChangeLog } > ChangeLog -hg rollback -hg commit -m "$clog" "${nopts[@]}" $cl +hg commit "$@" $cl