Mercurial > hg-stable
changeset 754:3e73bf876f17
Fixes and cleanups to hgeditor:
- "HG: merge resolve" isn't supported for a long time now.
- detection of unchanged commit message if signing is turned off.
- don't add manifest hash to commit message if not signing.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 22 Jul 2005 07:30:52 +0100 |
parents | 8760d0c83b9b |
children | 87e2b094ab86 |
files | hgeditor |
diffstat | 1 files changed, 28 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/hgeditor Thu Jul 21 18:20:13 2005 -0500 +++ b/hgeditor Fri Jul 22 07:30:52 2005 +0100 @@ -23,37 +23,35 @@ ;; esac -if grep -q "^HG: merge resolve" "$1" ; then - # we don't sign merges - exec $EDITOR "$1" -else - # Remove temporary files even if we get interrupted - trap "cleanup_exit 255" TERM KILL INT QUIT ABRT - T1=`mktemp`; T2=`mktemp` - MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-` +# Remove temporary files even if we get interrupted +trap "cleanup_exit 255" TERM KILL INT QUIT ABRT +T1=`mktemp`; T2=`mktemp` +( + cd "`hg root`" + grep '^HG: changed' "$1" | cut -b 13- | while read changed; do + hg diff "$changed" >> "$T2" + done +) - echo -e "\n\nmanifest hash: $MANIFEST" >> "$T1" - grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$T1" - ( - cd "`hg root`" - grep '^HG: changed' "$1" | cut -b 13- | while read changed; do - hg diff "$changed" >> "$T2" - done - ) - - CHECKSUM=`md5sum "$T1"` - $EDITOR "$T1" "$T2" || cleanup_exit $? +echo > "$T1" +if [ "$SIGN" == "1" ]; then + MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-` + echo -e "\nmanifest hash: $MANIFEST" >> "$T1" +fi +grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$T1" - if [ "$SIGN" == "1" ] ; then - echo "$CHECKSUM" | md5sum -c 2>/dev/null && cleanup_exit 13 - { - head -n 1 "$T1" - echo - grep -v "^HG:" "$T1" | gpg -t -a -u "${HGUSER}" --clearsign - } > "$T2" && mv "$T2" "$1" - else - mv "$T1" "$1" - fi - cleanup_exit $? +CHECKSUM=`md5sum "$T1"` +$EDITOR "$T1" "$T2" || cleanup_exit $? +echo "$CHECKSUM" | md5sum -c 2>/dev/null && cleanup_exit 13 + +if [ "$SIGN" == "1" ]; then + { + head -n 1 "$T1" + echo + grep -v "^HG:" "$T1" | gpg -t -a -u "${HGUSER}" --clearsign + } > "$T2" && mv "$T2" "$1" +else + mv "$T1" "$1" fi +cleanup_exit $?