##// END OF EJS Templates
Fixes and cleanups to hgeditor:...
Thomas Arendsen Hein -
r754:3e73bf87 default
parent child Browse files
Show More
@@ -23,17 +23,9 b' case "${EDITOR:=vi}" in'
23 ;;
23 ;;
24 esac
24 esac
25
25
26 if grep -q "^HG: merge resolve" "$1" ; then
27 # we don't sign merges
28 exec $EDITOR "$1"
29 else
30 # Remove temporary files even if we get interrupted
26 # Remove temporary files even if we get interrupted
31 trap "cleanup_exit 255" TERM KILL INT QUIT ABRT
27 trap "cleanup_exit 255" TERM KILL INT QUIT ABRT
32 T1=`mktemp`; T2=`mktemp`
28 T1=`mktemp`; T2=`mktemp`
33 MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-`
34
35 echo -e "\n\nmanifest hash: $MANIFEST" >> "$T1"
36 grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$T1"
37 (
29 (
38 cd "`hg root`"
30 cd "`hg root`"
39 grep '^HG: changed' "$1" | cut -b 13- | while read changed; do
31 grep '^HG: changed' "$1" | cut -b 13- | while read changed; do
@@ -41,11 +33,18 b' else'
41 done
33 done
42 )
34 )
43
35
36 echo > "$T1"
37 if [ "$SIGN" == "1" ]; then
38 MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-`
39 echo -e "\nmanifest hash: $MANIFEST" >> "$T1"
40 fi
41 grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$T1"
42
44 CHECKSUM=`md5sum "$T1"`
43 CHECKSUM=`md5sum "$T1"`
45 $EDITOR "$T1" "$T2" || cleanup_exit $?
44 $EDITOR "$T1" "$T2" || cleanup_exit $?
45 echo "$CHECKSUM" | md5sum -c 2>/dev/null && cleanup_exit 13
46
46
47 if [ "$SIGN" == "1" ] ; then
47 if [ "$SIGN" == "1" ]; then
48 echo "$CHECKSUM" | md5sum -c 2>/dev/null && cleanup_exit 13
49 {
48 {
50 head -n 1 "$T1"
49 head -n 1 "$T1"
51 echo
50 echo
@@ -54,6 +53,5 b' else'
54 else
53 else
55 mv "$T1" "$1"
54 mv "$T1" "$1"
56 fi
55 fi
56
57 cleanup_exit $?
57 cleanup_exit $?
58 fi
59
General Comments 0
You need to be logged in to leave comments. Login now