merge with crew
authorMatt Mackall <mpm@selenic.com>
Sun, 01 Jul 2012 21:19:57 -0500
changeset 17090 e64d416b6b94
parent 17076 75f4180509a4 (current diff)
parent 17089 0c1d10351869 (diff)
child 17091 f7a2849ef8cd
merge with crew
tests/test-histedit-commute
tests/test-histedit-commute.out
tests/test-histedit-drop
tests/test-histedit-drop.out
tests/test-histedit-edit
tests/test-histedit-edit.out
tests/test-histedit-fold
tests/test-histedit-fold-non-commute
tests/test-histedit-fold-non-commute.out
tests/test-histedit-fold.out
tests/test-histedit-no-change
tests/test-histedit-no-change.out
tests/test-histedit-non-commute
tests/test-histedit-non-commute-abort
tests/test-histedit-non-commute-abort.out
tests/test-histedit-non-commute.out
tests/test-histedit-outgoing
tests/test-histedit-outgoing.out
--- a/hgext/histedit.py	Wed Jun 06 01:56:58 2012 +0200
+++ b/hgext/histedit.py	Sun Jul 01 21:19:57 2012 -0500
@@ -476,7 +476,7 @@
             newtip = sorted(replacemap.values(), key=repo.changelog.rev)[-1]
             copybms(oldtip, newtip)
 
-            for old, new in replacemap.iteritems():
+            for old, new in sorted(replacemap.iteritems()):
                 copybms(old, new)
                 # TODO update mq state
 
--- a/tests/histedit-helpers.sh	Wed Jun 06 01:56:58 2012 +0200
+++ b/tests/histedit-helpers.sh	Sun Jul 01 21:19:57 2012 -0500
@@ -1,5 +1,3 @@
-#!/bin/sh
-
 fixbundle() {
     grep -v 'saving bundle' | grep -v 'saved backup' | \
         grep -v added | grep -v adding | \
--- a/tests/test-histedit-bookmark-motion.t	Wed Jun 06 01:56:58 2012 +0200
+++ b/tests/test-histedit-bookmark-motion.t	Sun Jul 01 21:19:57 2012 -0500
@@ -87,16 +87,16 @@
   histedit: Should update metadata for the following changes:
   histedit:  055a42cdd887 to ae467701c500
   histedit:     moving bookmarks three
+  histedit:  177f92b77385 to d36c0562f908
+  histedit:     moving bookmarks also-two, two
   histedit:  652413bf663e to 0efacef7cb48
   histedit:     moving bookmarks five
   histedit:  d2ae7f538514 to cb9a9f314b8b
   histedit:     moving bookmarks will-move-backwards
   histedit:  e860deea161a to ae467701c500
   histedit:     moving bookmarks four
-  histedit:  177f92b77385 to d36c0562f908
-  histedit:     moving bookmarks also-two, two
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/d2ae7f538514-backup.hg
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/34a9919932c1-backup.hg
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/d2ae7f538514-backup.hg (glob)
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/34a9919932c1-backup.hg (glob)
   $ hg log --graph
   @  changeset:   3:0efacef7cb48
   |  bookmark:    five
@@ -149,10 +149,10 @@
   histedit: Should update metadata for the following changes:
   histedit:  0efacef7cb48 to 1be9c35b4cb2
   histedit:     moving bookmarks five
+  histedit:  0efacef7cb48 to 7c044e3e33a9
   histedit:  ae467701c500 to 1be9c35b4cb2
   histedit:     moving bookmarks four, three
-  histedit:  0efacef7cb48 to 7c044e3e33a9
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/ae467701c500-backup.hg
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/ae467701c500-backup.hg (glob)
 
 We expect 'five' to stay at tip, since the tipmost bookmark is most
 likely the useful signal.
--- a/tests/test-histedit-commute	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-#!/bin/sh
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick e860deea161a e
-pick 652413bf663e f
-pick 055a42cdd887 d
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-}
-
-initrepo
-
-echo % log before edit
-hg log --graph
-
-echo % show the edit commands offered
-HGEDITOR=cat hg histedit 177f92b77385
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo % rules should end up in .hg/histedit-last-edit.txt:
-cat .hg/histedit-last-edit.txt
-echo '**** end of rules file ****'
-
-echo % log after edit
-hg log --graph
-
-echo % put things back
-
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick 853c68da763f d
-pick b069cc29fb22 e
-pick 26f6a030ae82 f
-EOF
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-hg log --graph
-
-
-echo % slightly different this time
-
-cat > $EDITED <<EOF
-pick 055a42cdd887 d
-pick 652413bf663e f
-pick e860deea161a e
-pick 177f92b77385 c
-EOF
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-hg log --graph
-
-
-echo % keep prevents stripping dead revs
-cat > $EDITED <<EOF
-pick bfe4a5a76b37 d
-pick c4f52e213402 f
-pick 99a62755c625 c
-pick 7c6fdd608667 e
-EOF
-HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
-hg log --graph
-
-echo '% try with --rev'
-cat > $EDITED <<EOF
-pick 7c6fdd608667 e
-pick 99a62755c625 c
-EOF
-hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle
-hg log --graph
-
-echo % should also work if a commit message is missing
-BUNDLE="$TESTDIR/missing-comment.hg"
-hg init missing
-cd missing
-hg unbundle $BUNDLE
-hg co tip
-hg log --graph
-hg histedit 0
--- a/tests/test-histedit-commute.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-% log before edit
-@  changeset:   5:652413bf663e
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% show the edit commands offered
-pick 177f92b77385 2 c
-pick 055a42cdd887 3 d
-pick e860deea161a 4 e
-pick 652413bf663e 5 f
-
-# Edit history between 177f92b77385 and 652413bf663e
-#
-# Commands:
-#  p, pick = use commit
-#  e, edit = use commit, but stop for amending
-#  f, fold = use commit, but fold into previous commit (combines N and N-1)
-#  d, drop = remove commit from history
-#  m, mess = edit message without changing commit content
-#
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% edit the history
-0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% rules should end up in .hg/histedit-last-edit.txt:
-pick 177f92b77385 c
-pick e860deea161a e
-pick 652413bf663e f
-pick 055a42cdd887 d
-**** end of rules file ****
-% log after edit
-@  changeset:   5:853c68da763f
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   4:26f6a030ae82
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   3:b069cc29fb22
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% put things back
-0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-@  changeset:   5:652413bf663e
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% slightly different this time
-0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-@  changeset:   5:99a62755c625
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   4:7c6fdd608667
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:c4f52e213402
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   2:bfe4a5a76b37
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% keep prevents stripping dead revs
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-@  changeset:   7:99e266581538
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   6:5ad36efb0653
-|  parent:      3:c4f52e213402
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-| o  changeset:   5:99a62755c625
-| |  user:        test
-| |  date:        Thu Jan 01 00:00:00 1970 +0000
-| |  summary:     c
-| |
-| o  changeset:   4:7c6fdd608667
-|/   user:        test
-|    date:        Thu Jan 01 00:00:00 1970 +0000
-|    summary:     e
-|
-o  changeset:   3:c4f52e213402
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   2:bfe4a5a76b37
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% try with --rev
-abort: may not use changesets other than the ones listed
-@  changeset:   7:99e266581538
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   6:5ad36efb0653
-|  parent:      3:c4f52e213402
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-| o  changeset:   5:99a62755c625
-| |  user:        test
-| |  date:        Thu Jan 01 00:00:00 1970 +0000
-| |  summary:     c
-| |
-| o  changeset:   4:7c6fdd608667
-|/   user:        test
-|    date:        Thu Jan 01 00:00:00 1970 +0000
-|    summary:     e
-|
-o  changeset:   3:c4f52e213402
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   2:bfe4a5a76b37
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% should also work if a commit message is missing
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 1 files
-(run 'hg update' to get a working copy)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-@  changeset:   2:bd22688093b3
-|  tag:         tip
-|  user:        Robert Altman <robert.altman@telventDTN.com>
-|  date:        Mon Nov 28 16:40:04 2011 +0000
-|  summary:     Update file.
-|
-o  changeset:   1:3b3e956f9171
-|  user:        Robert Altman <robert.altman@telventDTN.com>
-|  date:        Mon Nov 28 16:37:57 2011 +0000
-|
-o  changeset:   0:141947992243
-   user:        Robert Altman <robert.altman@telventDTN.com>
-   date:        Mon Nov 28 16:35:28 2011 +0000
-   summary:     Checked in text file
-
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-commute.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,359 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > pick 055a42cdd887 d
+  > EOF
+  $ initrepo ()
+  > {
+  >     hg init r
+  >     cd r
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  > }
+
+  $ initrepo
+
+log before edit
+  $ hg log --graph
+  @  changeset:   5:652413bf663e
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+show the edit commands offered
+  $ HGEDITOR=cat hg histedit 177f92b77385
+  pick 177f92b77385 2 c
+  pick 055a42cdd887 3 d
+  pick e860deea161a 4 e
+  pick 652413bf663e 5 f
+  
+  # Edit history between 177f92b77385 and 652413bf663e
+  #
+  # Commands:
+  #  p, pick = use commit
+  #  e, edit = use commit, but stop for amending
+  #  f, fold = use commit, but fold into previous commit (combines N and N-1)
+  #  d, drop = remove commit from history
+  #  m, mess = edit message without changing commit content
+  #
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+rules should end up in .hg/histedit-last-edit.txt:
+  $ cat .hg/histedit-last-edit.txt
+  pick 177f92b77385 c
+  pick e860deea161a e
+  pick 652413bf663e f
+  pick 055a42cdd887 d
+
+log after edit
+  $ hg log --graph
+  @  changeset:   5:853c68da763f
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   4:26f6a030ae82
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   3:b069cc29fb22
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+put things back
+
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick 853c68da763f d
+  > pick b069cc29fb22 e
+  > pick 26f6a030ae82 f
+  > EOF
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg log --graph
+  @  changeset:   5:652413bf663e
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+slightly different this time
+
+  $ cat > $EDITED <<EOF
+  > pick 055a42cdd887 d
+  > pick 652413bf663e f
+  > pick e860deea161a e
+  > pick 177f92b77385 c
+  > EOF
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log --graph
+  @  changeset:   5:99a62755c625
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   4:7c6fdd608667
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:c4f52e213402
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   2:bfe4a5a76b37
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+keep prevents stripping dead revs
+  $ cat > $EDITED <<EOF
+  > pick bfe4a5a76b37 d
+  > pick c4f52e213402 f
+  > pick 99a62755c625 c
+  > pick 7c6fdd608667 e
+  > EOF
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log --graph
+  > cat > $EDITED <<EOF
+  > pick 7c6fdd608667 e
+  > pick 99a62755c625 c
+  > EOF
+  @  changeset:   7:99e266581538
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   6:5ad36efb0653
+  |  parent:      3:c4f52e213402
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  | o  changeset:   5:99a62755c625
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c
+  | |
+  | o  changeset:   4:7c6fdd608667
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     e
+  |
+  o  changeset:   3:c4f52e213402
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   2:bfe4a5a76b37
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+try with --rev
+  $ hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle
+  abort: may not use changesets other than the ones listed
+  $ hg log --graph
+  @  changeset:   7:99e266581538
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   6:5ad36efb0653
+  |  parent:      3:c4f52e213402
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  | o  changeset:   5:99a62755c625
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     c
+  | |
+  | o  changeset:   4:7c6fdd608667
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     e
+  |
+  o  changeset:   3:c4f52e213402
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   2:bfe4a5a76b37
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+should also work if a commit message is missing
+  $ BUNDLE="$TESTDIR/missing-comment.hg"
+  $ hg init missing
+  $ cd missing
+  $ hg unbundle $BUNDLE
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ hg co tip
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log --graph
+  @  changeset:   2:bd22688093b3
+  |  tag:         tip
+  |  user:        Robert Altman <robert.altman@telventDTN.com>
+  |  date:        Mon Nov 28 16:40:04 2011 +0000
+  |  summary:     Update file.
+  |
+  o  changeset:   1:3b3e956f9171
+  |  user:        Robert Altman <robert.altman@telventDTN.com>
+  |  date:        Mon Nov 28 16:37:57 2011 +0000
+  |
+  o  changeset:   0:141947992243
+     user:        Robert Altman <robert.altman@telventDTN.com>
+     date:        Mon Nov 28 16:35:28 2011 +0000
+     summary:     Checked in text file
+  
+  $ hg histedit 0
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ..
--- a/tests/test-histedit-drop	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-drop 177f92b77385 c
-pick e860deea161a e
-pick 652413bf663e f
-pick 055a42cdd887 d
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-}
-
-initrepo
-
-echo % log before edit
-hg log --graph
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo % log after edit
-hg log --graph
-
-echo % manifest after edit
-hg manifest
-
-echo % EOF
--- a/tests/test-histedit-drop.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-% log before edit
-@  changeset:   5:652413bf663e
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% edit the history
-0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% log after edit
-@  changeset:   4:708943196e52
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   3:75cbdffecadb
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   2:493dc0964412
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% manifest after edit
-a
-b
-d
-e
-f
-% EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-drop.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,107 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > drop 177f92b77385 c
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > pick 055a42cdd887 d
+  > EOF
+  $ initrepo ()
+  > {
+  >     hg init r
+  >     cd r
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  > }
+
+  $ initrepo
+
+log before edit
+  $ hg log --graph
+  @  changeset:   5:652413bf663e
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+log after edit
+  $ hg log --graph
+  @  changeset:   4:708943196e52
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   3:75cbdffecadb
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   2:493dc0964412
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+manifest after edit
+  $ hg manifest
+  a
+  b
+  d
+  e
+  f
+
+  $ cd ..
--- a/tests/test-histedit-edit	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick 055a42cdd887 d
-edit e860deea161a e
-pick 652413bf663e f
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-}
-
-initrepo
-
-echo % log before edit
-hg log --graph
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo % commit, then edit the revision
-hg ci -m 'wat'
-echo a > e
-HGEDITOR='echo "foobaz" > ' hg histedit --continue 2>&1 | fixbundle
-
-hg log --graph
-
-echo '% contents of e:'
-hg cat e
-
-cat > $EDITED <<EOF
-edit bf757c081cd0 f
-EOF
-HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
-hg status
-HGEDITOR='true' hg histedit --continue
-hg status
-
-echo % log after edit
-hg log --limit 1
-
-echo "% say we'll change the message, but don't."
-cat > ../edit.sh <<EOF
-#!/bin/sh
-cat \$1 | sed s/pick/mess/ > tmp
-mv tmp \$1
-EOF
-chmod +x ../edit.sh
-HGEDITOR="../edit.sh" hg histedit tip 2>&1 | fixbundle
-hg status
-hg log --limit 1
-
-echo % modify the message
-cat > $EDITED <<EOF
-mess bf757c081cd0 f
-EOF
-HGEDITOR="cat $EDITED > " hg histedit tip 2>&1 | fixbundle
-hg status
-hg log --limit 1
-
-echo % rollback should not work after a histedit
-hg rollback
-
-echo % EOF
--- a/tests/test-histedit-edit.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-% log before edit
-@  changeset:   5:652413bf663e
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% edit the history
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-abort: Make changes as needed, you may commit or record as needed now.
-When you are finished, run hg histedit --continue to resume.
-% commit, then edit the revision
-created new head
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-@  changeset:   6:bf757c081cd0
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   5:d6b15fed32d4
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     foobaz
-|
-o  changeset:   4:1a60820cd1f6
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     wat
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% contents of e:
-a
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-abort: Make changes as needed, you may commit or record as needed now.
-When you are finished, run hg histedit --continue to resume.
-A f
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% log after edit
-changeset:   6:bf757c081cd0
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     f
-
-% say we'll change the message, but don't.
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-changeset:   6:bf757c081cd0
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     f
-
-% modify the message
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-changeset:   6:0b16746f8e89
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     mess bf757c081cd0 f
-
-% rollback should not work after a histedit
-no rollback information available
-% EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-edit.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,178 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick 055a42cdd887 d
+  > edit e860deea161a e
+  > pick 652413bf663e f
+  > EOF
+  $ initrepo ()
+  > {
+  >     hg init r
+  >     cd r
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  > }
+
+  $ initrepo
+
+log before edit
+  $ hg log --graph
+  @  changeset:   5:652413bf663e
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  abort: Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+
+commit, then edit the revision
+  $ hg ci -m 'wat'
+  created new head
+  $ echo a > e
+  $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg log --graph
+  @  changeset:   6:bf757c081cd0
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   5:d6b15fed32d4
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     foobaz
+  |
+  o  changeset:   4:1a60820cd1f6
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     wat
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+  $ hg cat e
+  a
+
+  $ cat > $EDITED <<EOF
+  > edit bf757c081cd0 f
+  > EOF
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  abort: Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+  $ hg status
+  A f
+  $ HGEDITOR='true' hg histedit --continue
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg status
+
+log after edit
+  $ hg log --limit 1
+  changeset:   6:bf757c081cd0
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     f
+  
+
+say we'll change the message, but don't.
+  $ cat > ../edit.sh <<EOF
+  > cat "\$1" | sed s/pick/mess/ > tmp
+  > mv tmp "\$1"
+  > EOF
+  $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg status
+  $ hg log --limit 1
+  changeset:   6:bf757c081cd0
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     f
+  
+
+modify the message
+  $ cat > $EDITED <<EOF
+  > mess bf757c081cd0 f
+  > EOF
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg status
+  $ hg log --limit 1
+  changeset:   6:0b16746f8e89
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     mess bf757c081cd0 f
+  
+
+rollback should not work after a histedit
+  $ hg rollback
+  no rollback information available
+  [1]
+
+  $ cd ..
--- a/tests/test-histedit-fold	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-pick e860deea161a e
-pick 652413bf663e f
-fold 177f92b77385 c
-pick 055a42cdd887 d
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-}
-
-initrepo
-
-echo % log before edit
-hg log --graph
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo % log after edit
-hg log --graph
-
-echo % post-fold manifest
-hg manifest
-
-echo % EOF
--- a/tests/test-histedit-fold-non-commute	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-#!/bin/sh
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick 055a42cdd887 d
-fold bfa474341cc9 does not commute with e
-pick e860deea161a e
-pick 652413bf663e f
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-    echo a >> e
-    hg ci -m 'does not commute with e'
-}
-
-initrepo
-
-echo % log before edit
-hg log --graph
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo % fix up
-echo a > e
-hg add e
-cat > cat.py <<EOF
-import sys
-print open(sys.argv[1]).read()
-print
-print
-EOF
-HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
-
-echo
-echo % just continue this time
-hg histedit --continue 2>&1 | fixbundle
-
-
-echo % log after edit
-hg log --graph
-
-echo % contents of e
-hg cat e
-
-echo % manifest
-hg manifest
-
-echo % EOF
--- a/tests/test-histedit-fold-non-commute.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-% log before edit
-@  changeset:   6:bfa474341cc9
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     does not commute with e
-|
-o  changeset:   5:652413bf663e
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% edit the history
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-% fix up
-d
-***
-does not commute with e
-
-
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-file e already exists
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-
-% just continue this time
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% log after edit
-@  changeset:   4:f768fd60ca34
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   3:671efe372e33
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% contents of e
-a
-% manifest
-a
-b
-c
-d
-e
-f
-% EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-fold-non-commute.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,146 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick 055a42cdd887 d
+  > fold bfa474341cc9 does not commute with e
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > EOF
+  $ initrepo ()
+  > {
+  >     hg init $1
+  >     cd $1
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  >     echo a >> e
+  >     hg ci -m 'does not commute with e'
+  >     cd ..
+  > }
+
+  $ initrepo r
+  $ cd r
+
+log before edit
+  $ hg log --graph
+  @  changeset:   6:bfa474341cc9
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     does not commute with e
+  |
+  o  changeset:   5:652413bf663e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+fix up
+  $ echo a > e
+  $ hg add e
+  $ cat > cat.py <<EOF
+  > import sys
+  > print open(sys.argv[1]).read()
+  > print
+  > print
+  > EOF
+  $ HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
+  d
+  ***
+  does not commute with e
+  
+  
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  file e already exists
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+just continue this time
+  $ hg histedit --continue 2>&1 | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+log after edit
+  $ hg log --graph
+  @  changeset:   4:f768fd60ca34
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   3:671efe372e33
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+contents of e
+  $ hg cat e
+  a
+
+manifest
+  $ hg manifest
+  a
+  b
+  c
+  d
+  e
+  f
+
+  $ cd ..
--- a/tests/test-histedit-fold.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-% log before edit
-@  changeset:   5:652413bf663e
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% edit the history
-0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% log after edit
-@  changeset:   4:82b0c1ff1777
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   3:150aafb44a91
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     pick e860deea161a e
-|
-o  changeset:   2:493dc0964412
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% post-fold manifest
-a
-b
-c
-d
-e
-f
-% EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-fold.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,110 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > fold 177f92b77385 c
+  > pick 055a42cdd887 d
+  > EOF
+  $ initrepo ()
+  > {
+  >     hg init r
+  >     cd r
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  > }
+
+  $ initrepo
+
+log before edit
+  $ hg log --graph
+  @  changeset:   5:652413bf663e
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+log after edit
+  $ hg log --graph
+  @  changeset:   4:82b0c1ff1777
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   3:150aafb44a91
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     pick e860deea161a e
+  |
+  o  changeset:   2:493dc0964412
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+post-fold manifest
+  $ hg manifest
+  a
+  b
+  c
+  d
+  e
+  f
+
+  $ cd ..
--- a/tests/test-histedit-no-change	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-#!/bin/sh
-
-# test for issue #6:
-# editing a changeset without any actual change would corrupt the repository
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-initrepo ()
-{
-    dir="$1"
-    comment="$2"
-
-    if [ -n "${comment}" ]; then
-        echo % ${comment}
-        echo % ${comment} | sed 's:.:-:g'
-    fi
-
-    hg init ${dir}
-    cd ${dir}
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-}
-
-geneditor ()
-{
-    # generate an editor script for selecting changesets to be edited
-
-    choice=$1  # changesets that should be edited (using sed line ranges)
-
-    cat <<EOF | sed 's:^....::'
-    #!/bin/sh
-
-    # editing the rules, replacing 'pick' with 'edit' for the chosen lines
-    sed '${choice}s:^pick:edit:' \$1 > \${1}.tmp
-    mv \${1}.tmp \$1
-
-    # displaying the resulting rules, minus comments and empty lines
-    sed '/^#/d;/^$/d;s:^:| :' \$1 >&2
-EOF
-}
-
-startediting ()
-{
-    # begin an editing session
-
-    choice="$1"  # changesets that should be edited
-    number="$2"  # number of changesets considered (from tip)
-    comment="$3"
-
-    geneditor "${choice}" > edit.sh
-    chmod +x edit.sh
-
-    echo % start editing the history ${comment}
-    HGEDITOR=./edit.sh hg histedit -- -${number} 2>&1 | fixbundle
-}
-
-continueediting ()
-{
-    # continue an edit already in progress
-
-    editor="$1"  # message editor when finalizing editing
-    comment="$2"
-
-    echo % finalize changeset editing ${comment}
-    HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle
-}
-
-graphlog ()
-{
-    comment="${1:-log}"
-
-    echo % "${comment}"
-    hg glog --template '{rev} {node} \"{desc|firstline}\"\n'
-}
-
-
-
-initrepo r1 "test editing with no change"
-graphlog "log before editing"
-startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets
-continueediting true "(leaving commit message unaltered)"
-
-echo "% check state of working copy"
-hg id
-
-graphlog "log after history editing"
-
-
-cd ..
-initrepo r2 "test editing with no change, then abort"
-graphlog "log before editing"
-startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets
-continueediting true "(leaving commit message unaltered)"
-graphlog "log after first edit"
-
-echo % abort editing session
-hg histedit --abort 2>&1 | fixbundle
-
-graphlog "log after abort"
-
-echo % EOF
--- a/tests/test-histedit-no-change.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-% test editing with no change
------------------------------
-% log before editing
-@  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
-|
-o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
-|
-o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
-|
-o  2 177f92b773850b59254aa5e923436f921b55483b "c"
-|
-o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
-|
-o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
-
-% start editing the history (not changing anything)
-| pick 055a42cdd887 3 d
-| edit e860deea161a 4 e
-| pick 652413bf663e 5 f
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-abort: Make changes as needed, you may commit or record as needed now.
-When you are finished, run hg histedit --continue to resume.
-% finalize changeset editing (leaving commit message unaltered)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% check state of working copy
-652413bf663e tip
-% log after history editing
-@  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
-|
-o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
-|
-o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
-|
-o  2 177f92b773850b59254aa5e923436f921b55483b "c"
-|
-o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
-|
-o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
-
-% test editing with no change, then abort
------------------------------------------
-% log before editing
-@  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
-|
-o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
-|
-o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
-|
-o  2 177f92b773850b59254aa5e923436f921b55483b "c"
-|
-o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
-|
-o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
-
-% start editing the history (not changing anything)
-| edit 055a42cdd887 3 d
-| edit e860deea161a 4 e
-| pick 652413bf663e 5 f
-0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-abort: Make changes as needed, you may commit or record as needed now.
-When you are finished, run hg histedit --continue to resume.
-% finalize changeset editing (leaving commit message unaltered)
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-abort: Make changes as needed, you may commit or record as needed now.
-When you are finished, run hg histedit --continue to resume.
-% log after first edit
-o  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
-|
-o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
-|
-@  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
-|
-o  2 177f92b773850b59254aa5e923436f921b55483b "c"
-|
-o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
-|
-o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
-
-% abort editing session
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% log after abort
-@  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
-|
-o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
-|
-o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
-|
-o  2 177f92b773850b59254aa5e923436f921b55483b "c"
-|
-o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
-|
-o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
-
-% EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-no-change.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,187 @@
+test for old histedit issue #6:
+editing a changeset without any actual change would corrupt the repository
+
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ initrepo ()
+  > {
+  >     dir="$1"
+  >     comment="$2"
+  >     if [ -n "${comment}" ]; then
+  >         echo % ${comment}
+  >         echo % ${comment} | sed 's:.:-:g'
+  >     fi
+  >     hg init ${dir}
+  >     cd ${dir}
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  >     cd ..
+  > }
+
+  $ geneditor ()
+  > {
+  >     # generate an editor script for selecting changesets to be edited
+  >     choice=$1  # changesets that should be edited (using sed line ranges)
+  >     cat <<EOF | sed 's:^....::'
+  >     # editing the rules, replacing 'pick' with 'edit' for the chosen lines
+  >     sed '${choice}s:^pick:edit:' "\$1" > "\${1}.tmp"
+  >     mv "\${1}.tmp" "\$1"
+  >     # displaying the resulting rules, minus comments and empty lines
+  >     sed '/^#/d;/^$/d;s:^:| :' "\$1" >&2
+  > EOF
+  > }
+
+  $ startediting ()
+  > {
+  >     # begin an editing session
+  >     choice="$1"  # changesets that should be edited
+  >     number="$2"  # number of changesets considered (from tip)
+  >     comment="$3"
+  >     geneditor "${choice}" > edit.sh
+  >     echo % start editing the history ${comment}
+  >     HGEDITOR="sh ./edit.sh" hg histedit -- -${number} 2>&1 | fixbundle
+  > }
+
+  $ continueediting ()
+  > {
+  >     # continue an edit already in progress
+  >     editor="$1"  # message editor when finalizing editing
+  >     comment="$2"
+  >     echo % finalize changeset editing ${comment}
+  >     HGEDITOR=${editor} hg histedit --continue 2>&1 | fixbundle
+  > }
+
+  $ graphlog ()
+  > {
+  >     comment="${1:-log}"
+  >     echo % "${comment}"
+  >     hg glog --template '{rev} {node} \"{desc|firstline}\"\n'
+  > }
+
+
+  $ initrepo r1 "test editing with no change"
+  % test editing with no change
+  -----------------------------
+  $ cd r1
+  $ graphlog "log before editing"
+  % log before editing
+  @  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  |
+  o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
+  |
+  o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
+  |
+  o  2 177f92b773850b59254aa5e923436f921b55483b "c"
+  |
+  o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
+  |
+  o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
+  
+  $ startediting 2 3 "(not changing anything)" # edit the 2nd of 3 changesets
+  % start editing the history (not changing anything)
+  | pick 055a42cdd887 3 d
+  | edit e860deea161a 4 e
+  | pick 652413bf663e 5 f
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  abort: Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+  $ continueediting true "(leaving commit message unaltered)"
+  % finalize changeset editing (leaving commit message unaltered)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+check state of working copy
+  $ hg id
+  652413bf663e tip
+
+  $ graphlog "log after history editing"
+  % log after history editing
+  @  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  |
+  o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
+  |
+  o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
+  |
+  o  2 177f92b773850b59254aa5e923436f921b55483b "c"
+  |
+  o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
+  |
+  o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
+  
+
+  $ cd ..
+
+  $ initrepo r2 "test editing with no change, then abort"
+  % test editing with no change, then abort
+  -----------------------------------------
+  $ cd r2
+  $ graphlog "log before editing"
+  % log before editing
+  @  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  |
+  o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
+  |
+  o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
+  |
+  o  2 177f92b773850b59254aa5e923436f921b55483b "c"
+  |
+  o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
+  |
+  o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
+  
+  $ startediting 1,2 3 "(not changing anything)" # edit the 1st two of 3 changesets
+  % start editing the history (not changing anything)
+  | edit 055a42cdd887 3 d
+  | edit e860deea161a 4 e
+  | pick 652413bf663e 5 f
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  abort: Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+  $ continueediting true "(leaving commit message unaltered)"
+  % finalize changeset editing (leaving commit message unaltered)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  abort: Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+  $ graphlog "log after first edit"
+  % log after first edit
+  o  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  |
+  o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
+  |
+  @  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
+  |
+  o  2 177f92b773850b59254aa5e923436f921b55483b "c"
+  |
+  o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
+  |
+  o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
+  
+
+abort editing session
+  $ hg histedit --abort 2>&1 | fixbundle
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ graphlog "log after abort"
+  % log after abort
+  @  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  |
+  o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
+  |
+  o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
+  |
+  o  2 177f92b773850b59254aa5e923436f921b55483b "c"
+  |
+  o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
+  |
+  o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
+  
+
+  $ cd ..
--- a/tests/test-histedit-non-commute	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-#!/bin/sh
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick 055a42cdd887 d
-pick bfa474341cc9 does not commute with e
-pick e860deea161a e
-pick 652413bf663e f
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-    echo a >> e
-    hg ci -m 'does not commute with e'
-}
-
-initrepo
-
-echo % log before edit
-hg log --graph
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo % abort the edit
-hg histedit --abort 2>&1 | fixbundle
-
-echo
-echo
-echo % second edit set
-
-hg log --graph
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo % fix up
-echo a > e
-hg add e
-hg histedit --continue 2>&1 | fixbundle
-
-echo
-echo % just continue this time
-hg histedit --continue 2>&1 | fixbundle
-
-echo % log after edit
-hg log --graph
-
-echo % start over
-
-cd ..
-rm -r r
-initrepo
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick 055a42cdd887 d
-mess bfa474341cc9 does not commute with e
-pick e860deea161a e
-pick 652413bf663e f
-EOF
-
-echo % edit the history, this time with a fold action
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo
-echo a > e
-hg add e
-HGEDITOR="cat $EDITED > " hg histedit --continue 2>&1 | fixbundle
-echo % second edit also fails, but just continue
-hg histedit --continue 2>&1 | fixbundle
-
-echo % post message fix
-hg log --graph
-
-echo % EOF
--- a/tests/test-histedit-non-commute-abort	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-#!/bin/sh
-
-. "$TESTDIR/histedit-helpers.sh"
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick 055a42cdd887 d
-pick bfa474341cc9 does not commute with e
-pick e860deea161a e
-pick 652413bf663e f
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-    echo a >> e
-    hg ci -m 'does not commute with e'
-}
-
-initrepo
-
-echo % log before edit
-hg log --graph
-
-echo % edit the history
-HGEDITOR="cat $EDITED > " hg histedit 177f92b77385 2>&1 | fixbundle
-
-echo '% fix up (pre abort)'
-echo a > e
-hg add e
-hg histedit --continue 2>&1 | fixbundle
-
-echo % abort the edit
-hg histedit --abort 2>&1 | fixbundle
-
-echo % log after abort
-hg log --graph
-echo % EOF
--- a/tests/test-histedit-non-commute-abort.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-% log before edit
-@  changeset:   6:bfa474341cc9
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     does not commute with e
-|
-o  changeset:   5:652413bf663e
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% edit the history
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-% fix up (pre abort)
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-file e already exists
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-% abort the edit
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% log after abort
-@  changeset:   6:bfa474341cc9
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     does not commute with e
-|
-o  changeset:   5:652413bf663e
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-non-commute-abort.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,131 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick 055a42cdd887 d
+  > pick bfa474341cc9 does not commute with e
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > EOF
+  $ initrepo ()
+  > {
+  >     hg init r
+  >     cd r
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  >     echo a >> e
+  >     hg ci -m 'does not commute with e'
+  >     cd ..
+  > }
+
+  $ initrepo
+  $ cd r
+
+log before edit
+  $ hg log --graph
+  @  changeset:   6:bfa474341cc9
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     does not commute with e
+  |
+  o  changeset:   5:652413bf663e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+fix up (pre abort)
+  $ echo a > e
+  $ hg add e
+  $ hg histedit --continue 2>&1 | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  file e already exists
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+abort the edit
+  $ hg histedit --abort 2>&1 | fixbundle
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+log after abort
+  $ hg log --graph
+  @  changeset:   6:bfa474341cc9
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     does not commute with e
+  |
+  o  changeset:   5:652413bf663e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+  $ cd ..
--- a/tests/test-histedit-non-commute.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-% log before edit
-@  changeset:   6:bfa474341cc9
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     does not commute with e
-|
-o  changeset:   5:652413bf663e
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% edit the history
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-% abort the edit
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-
-
-% second edit set
-@  changeset:   6:bfa474341cc9
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     does not commute with e
-|
-o  changeset:   5:652413bf663e
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:e860deea161a
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% edit the history
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-% fix up
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-file e already exists
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-
-% just continue this time
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% log after edit
-@  changeset:   5:9ab84894b459
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:1fff3ae8199d
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     does not commute with e
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% start over
-% edit the history, this time with a fold action
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-file e already exists
-1 out of 1 hunks FAILED -- saving rejects to file e.rej
-abort: Fix up the change and run hg histedit --continue
-% second edit also fails, but just continue
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% post message fix
-@  changeset:   5:6459970fb49b
-|  tag:         tip
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     f
-|
-o  changeset:   4:556f27c874b0
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     pick 177f92b77385 c
-|
-o  changeset:   3:055a42cdd887
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     d
-|
-o  changeset:   2:177f92b77385
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     c
-|
-o  changeset:   1:d2ae7f538514
-|  user:        test
-|  date:        Thu Jan 01 00:00:00 1970 +0000
-|  summary:     b
-|
-o  changeset:   0:cb9a9f314b8b
-   user:        test
-   date:        Thu Jan 01 00:00:00 1970 +0000
-   summary:     a
-
-% EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-non-commute.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,244 @@
+  $ . "$TESTDIR/histedit-helpers.sh"
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick 055a42cdd887 d
+  > pick bfa474341cc9 does not commute with e
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > EOF
+  $ initrepo ()
+  > {
+  >     hg init $1
+  >     cd $1
+  >     for x in a b c d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  >     echo a >> e
+  >     hg ci -m 'does not commute with e'
+  >     cd ..
+  > }
+
+  $ initrepo r1
+  $ cd r1
+
+log before edit
+  $ hg log --graph
+  @  changeset:   6:bfa474341cc9
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     does not commute with e
+  |
+  o  changeset:   5:652413bf663e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+abort the edit
+  $ hg histedit --abort 2>&1 | fixbundle
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+
+second edit set
+
+  $ hg log --graph
+  @  changeset:   6:bfa474341cc9
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     does not commute with e
+  |
+  o  changeset:   5:652413bf663e
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:e860deea161a
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+edit the history
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+fix up
+  $ echo a > e
+  $ hg add e
+  $ hg histedit --continue 2>&1 | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  file e already exists
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+just continue this time
+  $ hg histedit --continue 2>&1 | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+log after edit
+  $ hg log --graph
+  @  changeset:   5:9ab84894b459
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:1fff3ae8199d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     does not commute with e
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+start over
+
+  $ cd ..
+
+  $ initrepo r2
+  $ cd r2
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick 055a42cdd887 d
+  > mess bfa474341cc9 does not commute with e
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > EOF
+
+edit the history, this time with a fold action
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+
+  $ echo a > e
+  $ hg add e
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit --continue 2>&1 | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  file e already exists
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  abort: Fix up the change and run hg histedit --continue
+second edit also fails, but just continue
+  $ hg histedit --continue 2>&1 | fixbundle
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+post message fix
+  $ hg log --graph
+  @  changeset:   5:6459970fb49b
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     f
+  |
+  o  changeset:   4:556f27c874b0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     pick 177f92b77385 c
+  |
+  o  changeset:   3:055a42cdd887
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     d
+  |
+  o  changeset:   2:177f92b77385
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c
+  |
+  o  changeset:   1:d2ae7f538514
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     b
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     a
+  
+
+  $ cd ..
--- a/tests/test-histedit-outgoing	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#!/bin/sh
-
-cat >> $HGRCPATH <<EOF
-[extensions]
-graphlog=
-histedit=
-EOF
-
-EDITED=`pwd`/editedhistory
-cat > $EDITED <<EOF
-pick 177f92b77385 c
-pick e860deea161a e
-pick 652413bf663e f
-pick 055a42cdd887 d
-EOF
-initrepo ()
-{
-    hg init r
-    cd r
-    for x in a b c ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-
-    cd ..
-    hg clone r r2 | grep -v updating
-    cd r2
-    for x in d e f ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-
-    cd ..
-    hg init r3
-    cd r3
-    for x in g h i ; do
-        echo $x > $x
-        hg add $x
-        hg ci -m $x
-    done
-    cd ..
-}
-
-initrepo
-
-echo % show the edit commands offered by outgoing
-cd r2
-HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
-cd ..
-
-echo % show the error from unrelated repos
-cd r3
-HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
-cd ..
-
-echo % show the error from unrelated repos
-cd r3
-HGEDITOR=cat hg histedit --force --outgoing ../r
-cd ..
--- a/tests/test-histedit-outgoing.out	Wed Jun 06 01:56:58 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% show the edit commands offered by outgoing
-pick 055a42cdd887 3 d
-pick e860deea161a 4 e
-pick 652413bf663e 5 f
-
-# Edit history between 055a42cdd887 and 652413bf663e
-#
-# Commands:
-#  p, pick = use commit
-#  e, edit = use commit, but stop for amending
-#  f, fold = use commit, but fold into previous commit (combines N and N-1)
-#  d, drop = remove commit from history
-#  m, mess = edit message without changing commit content
-#
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% show the error from unrelated repos
-abort: repository is unrelated
-% show the error from unrelated repos
-comparing with ../r
-searching for changes
-warning: repository is unrelated
-pick 2a4042b45417 0 g
-pick 68c46b4927ce 1 h
-pick 51281e65ba79 2 i
-
-# Edit history between 2a4042b45417 and 51281e65ba79
-#
-# Commands:
-#  p, pick = use commit
-#  e, edit = use commit, but stop for amending
-#  f, fold = use commit, but fold into previous commit (combines N and N-1)
-#  d, drop = remove commit from history
-#  m, mess = edit message without changing commit content
-#
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-outgoing.t	Sun Jul 01 21:19:57 2012 -0500
@@ -0,0 +1,91 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > histedit=
+  > EOF
+
+  $ EDITED="$TESTTMP/editedhistory"
+  $ cat > $EDITED <<EOF
+  > pick 177f92b77385 c
+  > pick e860deea161a e
+  > pick 652413bf663e f
+  > pick 055a42cdd887 d
+  > EOF
+  $ initrepos ()
+  > {
+  >     hg init r
+  >     cd r
+  >     for x in a b c ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  >     cd ..
+  >     hg clone r r2 | grep -v updating
+  >     cd r2
+  >     for x in d e f ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  >     cd ..
+  >     hg init r3
+  >     cd r3
+  >     for x in g h i ; do
+  >         echo $x > $x
+  >         hg add $x
+  >         hg ci -m $x
+  >     done
+  >     cd ..
+  > }
+
+  $ initrepos
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+show the edit commands offered by outgoing
+  $ cd r2
+  $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
+  pick 055a42cdd887 3 d
+  pick e860deea161a 4 e
+  pick 652413bf663e 5 f
+  
+  # Edit history between 055a42cdd887 and 652413bf663e
+  #
+  # Commands:
+  #  p, pick = use commit
+  #  e, edit = use commit, but stop for amending
+  #  f, fold = use commit, but fold into previous commit (combines N and N-1)
+  #  d, drop = remove commit from history
+  #  m, mess = edit message without changing commit content
+  #
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ..
+
+show the error from unrelated repos
+  $ cd r3
+  $ HGEDITOR=cat hg histedit --outgoing ../r | grep -v comparing | grep -v searching
+  abort: repository is unrelated
+  [1]
+  $ cd ..
+
+show the error from unrelated repos
+  $ cd r3
+  $ HGEDITOR=cat hg histedit --force --outgoing ../r
+  comparing with ../r
+  searching for changes
+  warning: repository is unrelated
+  pick 2a4042b45417 0 g
+  pick 68c46b4927ce 1 h
+  pick 51281e65ba79 2 i
+  
+  # Edit history between 2a4042b45417 and 51281e65ba79
+  #
+  # Commands:
+  #  p, pick = use commit
+  #  e, edit = use commit, but stop for amending
+  #  f, fold = use commit, but fold into previous commit (combines N and N-1)
+  #  d, drop = remove commit from history
+  #  m, mess = edit message without changing commit content
+  #
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ..
--- a/tests/test-largefiles.t	Wed Jun 06 01:56:58 2012 +0200
+++ b/tests/test-largefiles.t	Sun Jul 01 21:19:57 2012 -0500
@@ -1,6 +1,5 @@
-  $ "$TESTDIR/hghave" serve || exit 80
-  $ USERCACHE=`pwd`/cache; export USERCACHE
-  $ mkdir -p ${USERCACHE}
+  $ USERCACHE="$TESTTMP/cache"; export USERCACHE
+  $ mkdir -p "${USERCACHE}"
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > largefiles=
@@ -14,7 +13,7 @@
   > patterns=glob:**.dat
   > usercache=${USERCACHE}
   > [hooks]
-  > precommit=echo "Invoking status precommit hook"; hg status
+  > precommit=sh -c "echo \"Invoking status precommit hook\"; hg status"
   > EOF
 
 Create the repo with a couple of revisions of both large and normal
@@ -142,6 +141,7 @@
   $ cat sub/large4
   large22
 
+#if hgweb
 Test display of largefiles in hgweb
 
   $ hg serve -d -p $HGPORT --pid-file ../hg.pid
@@ -164,6 +164,7 @@
   
   
   $ "$TESTDIR/killdaemons.py"
+#endif
 
 Test archiving the various revisions.  These hit corner cases known with
 archiving.
@@ -436,7 +437,7 @@
 
 Test cloning with --all-largefiles flag
 
-  $ rm -Rf ${USERCACHE}/*
+  $ rm -Rf "${USERCACHE}"/*
   $ hg clone --all-largefiles a a-backup
   updating to branch default
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -460,10 +461,10 @@
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   getting changed largefiles
   2 largefiles updated, 0 removed
-  $ rm -Rf ${USERCACHE}/*
+  $ rm -Rf "${USERCACHE}"/*
   $ cd a-backup
   $ hg pull --all-largefiles
-  pulling from $TESTTMP/a
+  pulling from $TESTTMP/a (glob)
   searching for changes
   adding changesets
   adding manifests
@@ -727,7 +728,7 @@
   3 largefiles updated, 0 removed
 # Delete the largefiles in the largefiles system cache so that we have an
 # opportunity to test that caching after a pull works.
-  $ rm ${USERCACHE}/*
+  $ rm "${USERCACHE}"/*
   $ cd f
   $ echo "large4-merge-test" > sub/large4
   $ hg commit -m "Modify large4 to test merge"
@@ -845,7 +846,7 @@
   normal3-modified
   $ hg cat sub/large4
   large4-modified
-  $ rm ${USERCACHE}/*
+  $ rm "${USERCACHE}"/*
   $ hg cat -r a381d2c8c80e -o cat.out sub/large4
   $ cat cat.out
   large4-modified
@@ -880,6 +881,7 @@
   (use 'hg revert new-largefile' to cancel the pending addition)
   $ cd ..
 
+#if serve
 vanilla clients not locked out from largefiles servers on vanilla repos
   $ mkdir r1
   $ cd r1
@@ -912,6 +914,8 @@
   added 1 changesets with 1 changes to 1 files
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+#endif
+
 
 vanilla clients locked out from largefiles http repos
   $ mkdir r4
@@ -923,6 +927,8 @@
   Invoking status precommit hook
   A f1
   $ cd ..
+
+#if serve
   $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
   $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
@@ -935,6 +941,7 @@
 
 used all HGPORTs, kill all daemons
   $ "$TESTDIR/killdaemons.py"
+#endif
 
 vanilla clients locked out from largefiles ssh repos
   $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
@@ -945,6 +952,8 @@
   Please enable it in your Mercurial config file.
   [255]
 
+#if serve
+
 largefiles clients refuse to push largefiles repos to vanilla servers
   $ mkdir r6
   $ cd r6
@@ -980,7 +989,7 @@
 
 putlfile errors are shown (issue3123)
 Corrupt the cached largefile in r7
-  $ echo corruption > $USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8
+  $ echo corruption > "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
   $ hg init empty
   $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
   >   --config 'web.allow_push=*' --config web.push_ssl=False
@@ -989,7 +998,7 @@
   pushing to http://localhost:$HGPORT1/
   searching for changes
   remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
-  abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/
+  abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
   [255]
   $ rm -rf empty
 
@@ -1004,7 +1013,7 @@
   $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
   >   --config 'web.allow_push=*' --config web.push_ssl=False
   $ cat hg.pid >> $DAEMON_PIDS
-  $ rm ${USERCACHE}/*
+  $ rm "${USERCACHE}"/*
   $ hg push -R r8 http://localhost:$HGPORT2
   pushing to http://localhost:$HGPORT2/
   searching for changes
@@ -1018,6 +1027,9 @@
 used all HGPORTs, kill all daemons
   $ "$TESTDIR/killdaemons.py"
 
+#endif
+
+
 #if unix-permissions
 
 Clone a local repository owned by another user