Merge with TAH
authormpm@selenic.com
Wed, 15 Jun 2005 00:33:57 -0800
changeset 350 b4e0e20646bbdd28ff6a7739250d6bd501445822
parent 346 f69a5d2d4fe1ecb6dbe1ca4a8ee5be2fc9397402 (current diff)
parent 349 b2293093b89e176707a3250f3e861382a0578aff (diff)
child 351 9525208e1c1da9e8676f31cdddfaa128dc5ffad8
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
Merge with TAH -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Merge with TAH manifest hash: ec82cc2d7b7357fd7db4917e09d7d6865482de58 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCr+f1ywK+sNU5EO8RAuPtAJ0WilDBo3iG4S/dmIabhzYW987TtgCgkjkM 8OmatsrjG01iJAhkKJj+XnQ= =mOLr -----END PGP SIGNATURE-----
contrib/hgit
hgeditor
mercurial/commands.py
mercurial/hg.py
mercurial/hgweb.py
mercurial/ui.py
tests/README
tests/run-tests
tests/test-basic
tests/test-basic.out
tests/test-help
tests/test-help.out
tests/test-pull
tests/test-pull.out
tests/test-simple-update
tests/test-simple-update.out
tests/test-undo
tests/test-undo.out
tests/test-up-local-change
tests/test-up-local-change.out
--- a/hgeditor
+++ b/hgeditor
@@ -1,21 +1,42 @@
 #!/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
+T1=""; T2=""
+cleanup_exit() {
+    rm -f "$T1" "$T2"
+    exit $1
+}
+
+case "${EDITOR:=vi}" in
+    emacs)
+        EDITOR="$EDITOR -nw"
+        ;;
+    gvim|vim)
+        EDITOR="$EDITOR -f -o"
+        ;;
+esac
+
+if grep -q "^HG: merge resolve" "$1" ; then
     # we don't sign merges
-    $EDITOR $1
+    exec $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
+    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"
+    hg diff >> "$T2"
+
+    CHECKSUM=`md5sum "$T1"`
+    $EDITOR "$T1" "$T2" || cleanup_exit $?
+    echo "$CHECKSUM" | md5sum -c 2>/dev/null && cleanup_exit 0
+    {
+        head -1 "$T1"
+        echo
+        grep -v "^HG:" "$T1" | gpg -a -u "${HGUSER:-$EMAIL}" --clearsign
+    } > "$T2" && mv "$T2" "$1"
+    cleanup_exit $?
 fi
+
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -76,30 +76,29 @@ def show_changeset(ui, repo, rev=0, chan
     changelog = repo.changelog
     if filelog:
         log = filelog
         filerev = rev
         node = filenode = filelog.node(filerev)
         changerev = filelog.linkrev(filenode)
         changenode = changenode or changelog.node(changerev)
     else:
+        log = changelog
         changerev = rev
-        log = changelog
         if changenode is None:
             changenode = changelog.node(changerev)
         elif not changerev:
             rev = changerev = changelog.rev(changenode)
         node = changenode
 
     if ui.quiet:
         ui.write("%d:%s\n" % (rev, hg.hex(node)))
         return
 
     changes = changelog.read(changenode)
-    description = changes[4].strip().splitlines()
 
     parents = [(log.rev(parent), hg.hex(parent))
                for parent in log.parents(node)
                if ui.debugflag or parent != hg.nullid]
     if not ui.debugflag and len(parents) == 1 and parents[0][0] == rev-1:
         parents = []
 
     if filelog:
@@ -112,23 +111,24 @@ def show_changeset(ui, repo, rev=0, chan
         for parent in parents:
             ui.write("parent:      %d:%s\n" % parent)
         ui.note("manifest:    %d:%s\n" % (repo.manifest.rev(changes[0]),
                                           hg.hex(changes[0])))
     ui.status("user:        %s\n" % changes[1])
     ui.status("date:        %s\n" % time.asctime(
         time.localtime(float(changes[2].split(' ')[0]))))
     ui.note("files:       %s\n" % " ".join(changes[3]))
+    description = changes[4].strip()
     if description:
         if ui.verbose:
             ui.status("description:\n")
-            ui.status(changes[4].strip())
-            ui.status("\n")
+            ui.status(description)
+            ui.status("\n\n")
         else:
-            ui.status("summary:     %s\n" % description[0])
+            ui.status("summary:     %s\n" % description.splitlines()[0])
     ui.status("\n")
 
 def help(ui, cmd=None):
     '''show help for a given command or all commands'''
     if cmd:
         try:
             i = find(cmd)
             ui.write("%s\n\n" % i[2])