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