comparison hgeditor @ 1599:f93fde8f5027

remove the gpg stuff from hgeditor (superseded by the signing extension) remove the gpg stuff from hgeditor, update the comments to make it clear it can be used to show a diff while commiting
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 27 Dec 2005 13:12:53 -0600
parents 1bc619b12025
children 20b621154e17
comparison
equal deleted inserted replaced
1598:14d1f1868bf6 1599:f93fde8f5027
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # This is an example of using HGEDITOR to automate the signing of 3 # This is an example of using HGEDITOR to create of diff to review the
4 # commits and so on. 4 # changes while commiting.
5
6 # change this to one to turn on GPG support
7 SIGN=0
8 5
9 # If you want to pass your favourite editor some other parameters 6 # If you want to pass your favourite editor some other parameters
10 # only for Mercurial, modify this: 7 # only for Mercurial, modify this:
11 case "${EDITOR}" in 8 case "${EDITOR}" in
12 "") 9 "")
41 grep '^HG: changed' "$1" | cut -b 13- | while read changed; do 38 grep '^HG: changed' "$1" | cut -b 13- | while read changed; do
42 hg diff "$changed" >> "$HGTMP/diff" 39 hg diff "$changed" >> "$HGTMP/diff"
43 done 40 done
44 ) 41 )
45 42
46 echo > "$HGTMP/msg" 43 cat "$1" > "$HGTMP/msg"
47 if [ "$SIGN" == "1" ]; then
48 MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-`
49 echo -e "\nmanifest hash: $MANIFEST" >> "$HGTMP/msg"
50 fi
51 grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$HGTMP/msg"
52 44
53 CHECKSUM=`md5sum "$HGTMP/msg"` 45 CHECKSUM=`md5sum "$HGTMP/msg"`
54 if [ -s "$HGTMP/diff" ]; then 46 if [ -s "$HGTMP/diff" ]; then
55 $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $? 47 $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
56 else 48 else
57 $EDITOR "$HGTMP/msg" || exit $? 49 $EDITOR "$HGTMP/msg" || exit $?
58 fi 50 fi
59 echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && exit 13 51 echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && exit 13
60 52
61 if [ "$SIGN" == "1" ]; then 53 mv "$HGTMP/msg" "$1"
62 {
63 head -n 1 "$HGTMP/msg"
64 echo
65 grep -v "^HG:" "$HGTMP/msg" | gpg -t -a -u "${HGUSER}" --clearsign
66 } > "$HGTMP/msg.gpg" && mv "$HGTMP/msg.gpg" "$1"
67 else
68 mv "$HGTMP/msg" "$1"
69 fi
70 54
71 exit $? 55 exit $?