hgeditor
author mpm@selenic.com
Wed, 08 Jun 2005 17:38:46 -0800
changeset 292 09364bcebdf0
parent 280 a69c3b2957d1
child 348 442eb02cf870
child 349 b2293093b89e
child 350 b4e0e20646bb
permissions -rwxr-xr-x
Make most file opening binary -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Make most file opening binary This should make Windows happier manifest hash: 4a906f7c55d8af4e962385c645852d0b3d858b42 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCp52mywK+sNU5EO8RAtOzAJwK8MOtl3B0MDAXyJDnDFt9mHNINwCfVdRG 8z35hXvIJhz3sRo0ogdUZ0s= =eM45 -----END PGP SIGNATURE-----

#!/bin/bash
#
# This is an example of using HGEDITOR to automate the signing of
# commits and so on.

MANIFEST=`grep '^HG: manifest hash' $1 | cut -b 19-`
if grep -q "^HG: merge resolve" $1 ; then
    # we don't sign merges
    $EDITOR $1
else
    T=`mktemp`
    CHANGED=`grep '^HG: changed' $1 | cut -b 13-`
    # show a diff so writing commit comments is easier
    hg diff $CHANGED >> $T
    echo -e "\n\nmanifest hash: $MANIFEST" > $1
    emacs -nw $T $1 
    head -1 $1 > $T
    echo >> $T
    gpg -a -u $HGUSER -o - --clearsign $1 >> $T
    mv $T $1
fi