From 8cd635bbf00c2b7fc9133d47e8457a26c9a494e4 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Tue, 6 Mar 2007 15:43:21 -0800 Subject: [PATCH] Make hg commit less clever --- hg-commit | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/hg-commit b/hg-commit index be86a33e..220272bb 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 -- 2.40.0