hgeditor: Simplify manifest hash adding
authorRadoslaw "AstralStorm" Szkodzinski <astralstorm@gorzow.mm.pl>
Sun, 10 Jul 2005 16:00:30 -0800
changeset 664 e1fbc1982372b66681a871e23e9c0370498f53e5
parent 663 562404de61fb4a8d32de222a59ead58b392a154a
child 665 40fd5722c66970942eaf019cb4ebb9a5ce92c034
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
hgeditor: Simplify manifest hash adding # HG changeset patch # User Radoslaw "AstralStorm" Szkodzinski <astralstorm@gorzow.mm.pl> # Node ID be12687d4bf0ce16c4207bef85c188de66efbf53 # Parent 341d27f865903223f8bf12382e3596167228a1c1 hgeditor: Simplify manifest hash adding I hope no one will miss the colon.
hgeditor
--- a/hgeditor
+++ b/hgeditor
@@ -18,20 +18,22 @@ case "${EDITOR:=vi}" in
         ;;
 esac
 
 if grep -q "^HG: merge resolve" "$1" ; then
     # we don't sign merges
     exec $EDITOR "$1"
 else
     T1=`mktemp`; T2=`mktemp`
-    MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-`
 
-    echo -e "\n\nmanifest hash: $MANIFEST" >> "$T1"
-    grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$T1"
+    # Add manifest hash in order to sign whole repository state.
+    # Remove HG: prefix, as we want that to be stored.
+    grep '^HG: manifest hash' "$1" | cut -b 5- >> "$T1"
+    # Add all other state information
+    grep -v '^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"`