[PATCH 6 of 9 PoC] mq2: don't strip popped changesets - keep them around so we can graft from them

Mads Kiilerich mads at kiilerich.com
Fri Aug 29 03:59:23 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1409150384 -7200
#      Wed Aug 27 16:39:44 2014 +0200
# Node ID 6947fcfff1f9b5e47c6e95c7bffabd360d90aacf
# Parent  f51d4707ff2686d3dbdf9de9062f1c035c343083
mq2: don't strip popped changesets - keep them around so we can graft from them

They can not be marked obsolete - they might be reused by qpush

TODO: mark as private/secret/hidden?

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1453,9 +1453,6 @@ class queue(object):
                 node = short(rev)
                 raise util.Abort(_('trying to pop unknown node %s') % node)
 
-            if heads != [self.applied[-1].node]:
-                raise util.Abort(_("popping would remove a revision not "
-                                   "managed by this patch queue"))
             if not repo[self.applied[-1].node].mutable():
                 raise util.Abort(
                     _("popping would remove an immutable revision"),
@@ -1486,7 +1483,7 @@ class queue(object):
             for patch in reversed(self.applied[start:end]):
                 self.ui.status(_("popping %s\n") % patch.name)
             del self.applied[start:end]
-            strip(self.ui, repo, [rev], update=False, backup=False)
+            self.ui.debug(_("pop updated to %s without stripping %s\n") % (repo['.'], short(rev)))
             for s, state in repo['.'].substate.items():
                 repo['.'].sub(s).get(state)
             if self.applied:
@@ -1526,7 +1523,7 @@ class queue(object):
             self.checktoppatch(repo)
             (top, patchfn) = (self.applied[-1].node, self.applied[-1].name)
             if repo.changelog.heads(top) != [top]:
-                raise util.Abort(_("cannot refresh a revision with children"))
+                self.ui.debug(_("refreshing a revision with children\n"))
             if not repo[top].mutable():
                 raise util.Abort(_("cannot refresh immutable revision"),
                                  hint=_('see "hg help phases" for details'))
diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t
--- a/tests/test-mq-eol.t
+++ b/tests/test-mq-eol.t
@@ -71,6 +71,7 @@ should fail in strict mode
 invalid eol
 
   $ hg --config patch.eol='LFCR' qpush
+  (working directory not at a head)
   applying eol.diff
   patch failed, unable to continue (try -v)
   patch failed, rejects left in working dir
@@ -83,6 +84,7 @@ invalid eol
 force LF
 
   $ hg --config patch.eol='CRLF' qpush
+  (working directory not at a head)
   applying eol.diff
   now at: eol.diff
   $ hg qrefresh
@@ -119,6 +121,7 @@ force LF
 push again forcing LF and compare revisions
 
   $ hg --config patch.eol='CRLF' qpush
+  (working directory not at a head)
   applying eol.diff
   now at: eol.diff
   $ python ../cateol.py a
@@ -134,6 +137,7 @@ push again forcing LF and compare revisi
 push again without LF and compare revisions
 
   $ hg qpush
+  (working directory not at a head)
   applying eol.diff
   now at: eol.diff
   $ python ../cateol.py a
@@ -162,6 +166,7 @@ Test .rej file EOL are left unchanged
   patch queue now empty
   $ python -c "file('a', 'wb').write('1\r\n22\r\n33\r\n4')"
   $ hg ci -m changea
+  created new head
 
   $ hg --config 'patch.eol=LF' qpush
   applying patch1
@@ -187,6 +192,7 @@ Test .rej file EOL are left unchanged
   \ No newline at end of file
 
   $ hg --config 'patch.eol=auto' qpush
+  (working directory not at a head)
   applying patch1
   patching file a
   Hunk #1 FAILED at 0
diff --git a/tests/test-mq-guards.t b/tests/test-mq-guards.t
--- a/tests/test-mq-guards.t
+++ b/tests/test-mq-guards.t
@@ -46,6 +46,7 @@ should fail
   [255]
 
   $ hg qpush
+  (working directory not at a head)
   applying a.patch
   now at: a.patch
 
@@ -65,6 +66,7 @@ should print +a
 should fail
 
   $ hg qpush a.patch
+  (working directory not at a head)
   cannot push 'a.patch' - guarded by '+a'
   [1]
 
@@ -74,6 +76,7 @@ should fail
 should push b.patch
 
   $ hg qpush
+  (working directory not at a head)
   applying b.patch
   now at: b.patch
 
@@ -92,6 +95,7 @@ test selection of an empty guard
 should push a.patch
 
   $ hg qpush
+  (working directory not at a head)
   applying a.patch
   now at: a.patch
 
@@ -138,6 +142,7 @@ should push c.patch
 should push all
 
   $ hg qpush -a
+  (working directory not at a head)
   applying b.patch
   applying c.patch
   now at: c.patch
@@ -154,9 +159,11 @@ should push all
 should push a.patch, not b.patch
 
   $ hg qpush
+  (working directory not at a head)
   applying a.patch
   now at: a.patch
   $ hg qpush
+  (working directory not at a head)
   applying c.patch
   now at: c.patch
   $ hg qpop -a
@@ -169,9 +176,11 @@ should push a.patch, not b.patch
 should push b.patch
 
   $ hg qpush
+  (working directory not at a head)
   applying b.patch
   now at: b.patch
   $ hg qpush -a
+  (working directory not at a head)
   applying c.patch
   now at: c.patch
   $ hg qprev
@@ -193,9 +202,11 @@ So, put one hole on the base and ask for
 should push a.patch, b.patch
 
   $ hg qpush
+  (working directory not at a head)
   applying a.patch
   now at: a.patch
   $ hg qpush
+  (working directory not at a head)
   applying b.patch
   now at: b.patch
   $ hg qpop -a
@@ -218,6 +229,7 @@ list patches and guards
 have at least one patch applied to test coloring
 
   $ hg qpush
+  (working directory not at a head)
   applying b.patch
   now at: b.patch
 
@@ -252,10 +264,12 @@ list guards
 should push b.patch
 
   $ hg qpush
+  (working directory not at a head)
   applying b.patch
   now at: b.patch
 
   $ hg qpush -a
+  (working directory not at a head)
   applying c.patch
   now at: c.patch
   $ hg qselect -n --reapply
@@ -265,6 +279,7 @@ should push b.patch
   popping b.patch
   patch queue now empty
   reapplying unguarded patches
+  (working directory not at a head)
   applying c.patch
   now at: c.patch
 
@@ -372,6 +387,7 @@ new.patch, b.patch: Guarded. c.patch: Ap
   2 U c.patch
   3 G d.patch
   $ hg qpush -a
+  (working directory not at a head)
   applying new.patch
   skipping b.patch - guarded by '+2'
   applying c.patch
@@ -453,6 +469,7 @@ excercise corner cases in "qselect --rea
   $ hg qguard -- c.patch -not-c
   $ hg qguard -- d.patch -not-d
   $ hg qpush -a
+  (working directory not at a head)
   applying new.patch
   applying c.patch
   applying d.patch
@@ -467,6 +484,7 @@ excercise corner cases in "qselect --rea
   popping d.patch
   now at: c.patch
   reapplying unguarded patches
+  (working directory not at a head)
   cannot push 'd.patch' - guarded by '-not-d'
   $ hg qser -v
   0 A new.patch
@@ -475,6 +493,7 @@ excercise corner cases in "qselect --rea
   $ hg qselect --reapply -n
   guards deactivated
   $ hg qpush
+  (working directory not at a head)
   applying d.patch
   patch d.patch is empty
   now at: d.patch
@@ -488,6 +507,7 @@ excercise corner cases in "qselect --rea
   popping c.patch
   now at: new.patch
   reapplying unguarded patches
+  (working directory not at a head)
   applying d.patch
   patch d.patch is empty
   now at: d.patch
@@ -501,6 +521,7 @@ excercise corner cases in "qselect --rea
   popping new.patch
   patch queue now empty
   reapplying unguarded patches
+  (working directory not at a head)
   applying c.patch
   applying d.patch
   patch d.patch is empty
diff --git a/tests/test-mq-header-date.t b/tests/test-mq-header-date.t
--- a/tests/test-mq-header-date.t
+++ b/tests/test-mq-header-date.t
@@ -251,7 +251,8 @@
   
   Three
   
-  5: Three - test - 6.00
+  6: Three - test - 6.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref
   adding 3
@@ -264,7 +265,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  6: Three - test - 6.00
+  7: Three - test - 6.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref -m
   Date: 6 0
@@ -276,7 +278,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  7: Drei - test - 6.00
+  8: Drei - test - 6.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref -d
   Date: 7 0
@@ -288,7 +291,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  8: Drei - test - 7.00
+  9: Drei - test - 7.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref -d -m
   Date: 8 0
@@ -300,7 +304,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  9: Three (again) - test - 8.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qnew -m
   adding 4
@@ -313,8 +318,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  11: Four - test
-  9: Three (again) - test
+  12: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -d
   Date: 9 0
@@ -326,8 +332,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  12: Four - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 4.patch
   now at: 3.patch
@@ -338,8 +345,11 @@
   
   # HG changeset patch
   # Date 10 0
-  12: imported patch 5.patch - test - 10.00
-  9: Three (again) - test - 8.00
+  15: imported patch 5.patch - test - 10.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== hg qref
   adding 5
@@ -354,8 +364,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  13: [mq]: 5.patch - test - 10.00
-  9: Three (again) - test - 8.00
+  16: [mq]: 5.patch - test - 10.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   Date: 11 0
@@ -369,8 +382,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qnew with plain header
   popping 6.patch
@@ -378,9 +394,13 @@
   now at: 6.patch
   Date: 12 0
   
-  15: imported patch 6.patch - test
+  19: imported patch 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== hg qref
   adding 6
@@ -391,9 +411,13 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  16: [mq]: 6.patch - test - 12.00
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  20: [mq]: 6.patch - test - 12.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   Date: 13 0
@@ -403,9 +427,13 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  17: [mq]: 6.patch - test - 13.00
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  21: [mq]: 6.patch - test - 13.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   popping 6.patch
   now at: 5.patch
@@ -419,9 +447,14 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  18: [mq]: 6.patch - jane
+  23: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -d
   From: jane
@@ -432,9 +465,14 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  19: [mq]: 6.patch - jane
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 6.patch
   now at: 5.patch
@@ -447,9 +485,15 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  20: [mq]: 7.patch - test
+  26: [mq]: 7.patch - test
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -u
   From: john
@@ -460,9 +504,15 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  21: [mq]: 7.patch - john - 13.00
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  27: [mq]: 7.patch - john - 13.00
+  24: [mq]: 6.patch - jane - 12.00
+  21: [mq]: 6.patch - test - 13.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qnew
   adding 8
@@ -473,10 +523,16 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  23: [mq]: 8.patch - test
-  21: [mq]: 7.patch - john
+  29: [mq]: 8.patch - test
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -u -d
   From: john
@@ -487,10 +543,16 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  24: [mq]: 8.patch - john
-  21: [mq]: 7.patch - john
+  30: [mq]: 8.patch - john
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 8.patch
   now at: 7.patch
@@ -505,10 +567,17 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  25: Nine - test
-  21: [mq]: 7.patch - john
+  32: Nine - test
+  30: [mq]: 8.patch - john
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -u -d
   From: john
@@ -521,10 +590,17 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  26: Nine - john
-  21: [mq]: 7.patch - john
+  33: Nine - john
+  30: [mq]: 8.patch - john
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 9.patch
   now at: 7.patch
@@ -534,15 +610,28 @@
   popping 3.patch
   popping 1.patch
   patch queue now empty
+  (working directory not at a head)
   applying 1.patch
   applying 3.patch
   applying 5.patch
   applying 7.patch
   now at: 7.patch
-  5: imported patch 7.patch - john - 13.00
-  4: imported patch 5.patch - test - 11.00
-  3: Three (again) - test - 8.00
-  2: imported patch 1.patch - test - 4.00
+  37: imported patch 7.patch - john - 13.00
+  36: imported patch 5.patch - test - 11.00
+  35: Three (again) - test - 8.00
+  34: imported patch 1.patch - test - 4.00
+  33: Nine - john - 15.00
+  30: [mq]: 8.patch - john - 14.00
+  27: [mq]: 7.patch - john - 13.00
+  24: [mq]: 6.patch - jane - 12.00
+  21: [mq]: 6.patch - test - 13.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
+  2: [mq]: 1.patch - test - 4.00
   $ rm -r sandbox
 
 ======= hg headers
@@ -620,7 +709,8 @@
   
   Three
   
-  5: Three - test - 6.00
+  6: Three - test - 6.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref
   adding 3
@@ -636,7 +726,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  6: Three - test - 6.00
+  7: Three - test - 6.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref -m
   # HG changeset patch
@@ -651,7 +742,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  7: Drei - test - 6.00
+  8: Drei - test - 6.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref -d
   # HG changeset patch
@@ -666,7 +758,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  8: Drei - test - 7.00
+  9: Drei - test - 7.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qref -d -m
   # HG changeset patch
@@ -681,7 +774,8 @@
   +++ b/3
   @@ -0,0 +1,1 @@
   +3
-  9: Three (again) - test - 8.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qnew -m
   adding 4
@@ -697,8 +791,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  11: Four - test
-  9: Three (again) - test
+  12: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -d
   # HG changeset patch
@@ -713,8 +808,9 @@
   +++ b/4
   @@ -0,0 +1,1 @@
   +4
-  12: Four - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 4.patch
   now at: 3.patch
@@ -725,8 +821,11 @@
   
   # HG changeset patch
   # Date 10 0
-  12: imported patch 5.patch - test - 10.00
-  9: Three (again) - test - 8.00
+  15: imported patch 5.patch - test - 10.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== hg qref
   adding 5
@@ -742,8 +841,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  13: [mq]: 5.patch - test - 10.00
-  9: Three (again) - test - 8.00
+  16: [mq]: 5.patch - test - 10.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   Date: 11 0
@@ -758,8 +860,11 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qnew with plain header
   popping 6.patch
@@ -767,9 +872,13 @@
   now at: 6.patch
   Date: 12 0
   
-  15: imported patch 6.patch - test
+  19: imported patch 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== hg qref
   adding 6
@@ -780,9 +889,13 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  16: [mq]: 6.patch - test - 12.00
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  20: [mq]: 6.patch - test - 12.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== hg qref -d
   Date: 13 0
@@ -792,9 +905,13 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  17: [mq]: 6.patch - test - 13.00
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  21: [mq]: 6.patch - test - 13.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   popping 6.patch
   now at: 5.patch
@@ -811,9 +928,14 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  18: [mq]: 6.patch - jane
+  23: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -d
   # HG changeset patch
@@ -827,9 +949,14 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  19: [mq]: 6.patch - jane
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 6.patch
   now at: 5.patch
@@ -845,9 +972,15 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  20: [mq]: 7.patch - test
+  26: [mq]: 7.patch - test
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -u
   # HG changeset patch
@@ -861,9 +994,15 @@
   +++ b/7
   @@ -0,0 +1,1 @@
   +7
-  21: [mq]: 7.patch - john - 13.00
-  14: [mq]: 5.patch - test - 11.00
-  9: Three (again) - test - 8.00
+  27: [mq]: 7.patch - john - 13.00
+  24: [mq]: 6.patch - jane - 12.00
+  21: [mq]: 6.patch - test - 13.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
   2: [mq]: 1.patch - test - 4.00
   ==== qnew
   adding 8
@@ -877,10 +1016,16 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  23: [mq]: 8.patch - test
-  21: [mq]: 7.patch - john
+  29: [mq]: 8.patch - test
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -u -d
   # HG changeset patch
@@ -894,10 +1039,16 @@
   +++ b/8
   @@ -0,0 +1,1 @@
   +8
-  24: [mq]: 8.patch - john
-  21: [mq]: 7.patch - john
+  30: [mq]: 8.patch - john
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 8.patch
   now at: 7.patch
@@ -915,10 +1066,17 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  25: Nine - test
-  21: [mq]: 7.patch - john
+  32: Nine - test
+  30: [mq]: 8.patch - john
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   ==== qref -u -d
   # HG changeset patch
@@ -934,10 +1092,17 @@
   +++ b/9
   @@ -0,0 +1,1 @@
   +9
-  26: Nine - john
-  21: [mq]: 7.patch - john
+  33: Nine - john
+  30: [mq]: 8.patch - john
+  27: [mq]: 7.patch - john
+  24: [mq]: 6.patch - jane
+  21: [mq]: 6.patch - test
+  18: [mq]: 6.patch - test
+  17: [mq]: 5.patch - test
   14: [mq]: 5.patch - test
-  9: Three (again) - test
+  13: Four - test
+  10: Three (again) - test
+  5: [mq]: 2.patch - test
   2: [mq]: 1.patch - test
   popping 9.patch
   now at: 7.patch
@@ -947,13 +1112,26 @@
   popping 3.patch
   popping 1.patch
   patch queue now empty
+  (working directory not at a head)
   applying 1.patch
   applying 3.patch
   applying 5.patch
   applying 7.patch
   now at: 7.patch
-  5: imported patch 7.patch - john - 13.00
-  4: imported patch 5.patch - test - 11.00
-  3: Three (again) - test - 8.00
-  2: imported patch 1.patch - test - 4.00
+  37: imported patch 7.patch - john - 13.00
+  36: imported patch 5.patch - test - 11.00
+  35: Three (again) - test - 8.00
+  34: imported patch 1.patch - test - 4.00
+  33: Nine - john - 15.00
+  30: [mq]: 8.patch - john - 14.00
+  27: [mq]: 7.patch - john - 13.00
+  24: [mq]: 6.patch - jane - 12.00
+  21: [mq]: 6.patch - test - 13.00
+  18: [mq]: 6.patch - test - 12.00
+  17: [mq]: 5.patch - test - 11.00
+  14: [mq]: 5.patch - test - 1.00
+  13: Four - test - 9.00
+  10: Three (again) - test - 8.00
+  5: [mq]: 2.patch - test - 5.00
+  2: [mq]: 1.patch - test - 4.00
   $ rm -r sandbox
diff --git a/tests/test-mq-header-from.t b/tests/test-mq-header-from.t
--- a/tests/test-mq-header-from.t
+++ b/tests/test-mq-header-from.t
@@ -287,7 +287,8 @@
   
   # HG changeset patch
   # User johndoe
-  14: imported patch 5.patch - johndoe
+  15: imported patch 5.patch - johndoe
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -305,7 +306,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  15: [mq]: 5.patch - johndoe
+  16: [mq]: 5.patch - johndoe
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -322,7 +324,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  16: [mq]: 5.patch - test
+  17: [mq]: 5.patch - test
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -339,7 +342,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -351,8 +355,10 @@
   From: test
   Date: 1 0
   
-  18: imported patch 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  20: imported patch 6.patch - test
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -367,8 +373,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
+  21: [mq]: 6.patch - test
   19: [mq]: 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -382,8 +390,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
+  21: [mq]: 6.patch - test
   19: [mq]: 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -397,8 +407,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  20: [mq]: 6.patch - johndeere
-  17: [mq]: 5.patch - johndeere
+  22: [mq]: 6.patch - johndeere
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -411,6 +423,7 @@
   popping 2.patch
   popping 1.patch
   patch queue now empty
+  (working directory not at a head)
   applying 1.patch
   applying 2.patch
   applying 3.patch
@@ -418,12 +431,20 @@
   applying 5.patch
   applying 6.patch
   now at: 6.patch
-  7: imported patch 6.patch - johndeere
-  6: imported patch 5.patch - johndeere
-  5: Four - jane
-  4: Three (again) - maria
-  3: imported patch 2.patch - jane
-  2: imported patch 1.patch - mary
+  28: imported patch 6.patch - johndeere
+  27: imported patch 5.patch - johndeere
+  26: Four - jane
+  25: Three (again) - maria
+  24: imported patch 2.patch - jane
+  23: imported patch 1.patch - mary
+  22: [mq]: 6.patch - johndeere
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
+  13: Four - jane
+  10: Three (again) - maria
+  5: [mq]: 2.patch - jane
+  2: [mq]: 1.patch - mary
   $ rm -r sandbox
 
 ======= hg headers
@@ -620,7 +641,8 @@
   
   # HG changeset patch
   # User johndoe
-  14: imported patch 5.patch - johndoe
+  15: imported patch 5.patch - johndoe
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -639,7 +661,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  15: [mq]: 5.patch - johndoe
+  16: [mq]: 5.patch - johndoe
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -657,7 +680,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  16: [mq]: 5.patch - test
+  17: [mq]: 5.patch - test
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -675,7 +699,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -687,8 +712,10 @@
   From: test
   Date: 1 0
   
-  18: imported patch 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  20: imported patch 6.patch - test
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -703,8 +730,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
+  21: [mq]: 6.patch - test
   19: [mq]: 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -718,8 +747,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
+  21: [mq]: 6.patch - test
   19: [mq]: 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -733,8 +764,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  20: [mq]: 6.patch - johndeere
-  17: [mq]: 5.patch - johndeere
+  22: [mq]: 6.patch - johndeere
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -747,6 +780,7 @@
   popping 2.patch
   popping 1.patch
   patch queue now empty
+  (working directory not at a head)
   applying 1.patch
   applying 2.patch
   applying 3.patch
@@ -754,12 +788,20 @@
   applying 5.patch
   applying 6.patch
   now at: 6.patch
-  7: imported patch 6.patch - johndeere
-  6: imported patch 5.patch - johndeere
-  5: Four - jane
-  4: Three (again) - maria
-  3: imported patch 2.patch - jane
-  2: imported patch 1.patch - mary
+  28: imported patch 6.patch - johndeere
+  27: imported patch 5.patch - johndeere
+  26: Four - jane
+  25: Three (again) - maria
+  24: imported patch 2.patch - jane
+  23: imported patch 1.patch - mary
+  22: [mq]: 6.patch - johndeere
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
+  13: Four - jane
+  10: Three (again) - maria
+  5: [mq]: 2.patch - jane
+  2: [mq]: 1.patch - mary
   $ rm -r sandbox
   $ runtest
   ==== init
@@ -951,7 +993,8 @@
   
   # HG changeset patch
   # User johndoe
-  14: imported patch 5.patch - johndoe
+  15: imported patch 5.patch - johndoe
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -970,7 +1013,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  15: [mq]: 5.patch - johndoe
+  16: [mq]: 5.patch - johndoe
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -988,7 +1032,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  16: [mq]: 5.patch - test
+  17: [mq]: 5.patch - test
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -1006,7 +1051,8 @@
   +++ b/5
   @@ -0,0 +1,1 @@
   +5
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -1018,8 +1064,10 @@
   From: test
   Date: 1 0
   
-  18: imported patch 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  20: imported patch 6.patch - test
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -1034,8 +1082,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
+  21: [mq]: 6.patch - test
   19: [mq]: 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -1049,8 +1099,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
+  21: [mq]: 6.patch - test
   19: [mq]: 6.patch - test
-  17: [mq]: 5.patch - johndeere
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -1064,8 +1116,10 @@
   +++ b/6
   @@ -0,0 +1,1 @@
   +6
-  20: [mq]: 6.patch - johndeere
-  17: [mq]: 5.patch - johndeere
+  22: [mq]: 6.patch - johndeere
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
   13: Four - jane
   10: Three (again) - maria
   5: [mq]: 2.patch - jane
@@ -1078,6 +1132,7 @@
   popping 2.patch
   popping 1.patch
   patch queue now empty
+  (working directory not at a head)
   applying 1.patch
   applying 2.patch
   applying 3.patch
@@ -1085,11 +1140,19 @@
   applying 5.patch
   applying 6.patch
   now at: 6.patch
-  7: imported patch 6.patch - johndeere
-  6: imported patch 5.patch - johndeere
-  5: Four - jane
-  4: Three (again) - maria
-  3: imported patch 2.patch - jane
-  2: imported patch 1.patch - mary
+  28: imported patch 6.patch - johndeere
+  27: imported patch 5.patch - johndeere
+  26: Four - jane
+  25: Three (again) - maria
+  24: imported patch 2.patch - jane
+  23: imported patch 1.patch - mary
+  22: [mq]: 6.patch - johndeere
+  19: [mq]: 6.patch - test
+  18: [mq]: 5.patch - johndeere
+  14: [mq]: 5.patch - test
+  13: Four - jane
+  10: Three (again) - maria
+  5: [mq]: 2.patch - jane
+  2: [mq]: 1.patch - mary
 
   $ cd ..
diff --git a/tests/test-mq-missingfiles.t b/tests/test-mq-missingfiles.t
--- a/tests/test-mq-missingfiles.t
+++ b/tests/test-mq-missingfiles.t
@@ -38,6 +38,7 @@ future qrefresh.
   patch queue now empty
   $ hg rm b
   $ hg ci -Am rmb
+  created new head
   $ hg tag -l rmb
 
 Push patch with missing target:
@@ -93,6 +94,7 @@ Test missing renamed file
   patch queue now empty
   $ hg up -qC rmb
   $ hg qpush
+  (working directory not at a head)
   applying changebb
   patching file bb
   Hunk #1 FAILED at 0
@@ -144,6 +146,7 @@ Test missing renamed file
   patch queue now empty
   $ hg rm b
   $ hg ci -Am rmb
+  created new head
 
 Push git patch with missing target:
 
@@ -191,6 +194,7 @@ Test push creating directory during git 
   popping patch
   patch queue now empty
   $ hg qpush
+  (working directory not at a head)
   applying patch
   now at: patch
 
diff --git a/tests/test-mq-pull-from-bundle.t b/tests/test-mq-pull-from-bundle.t
--- a/tests/test-mq-pull-from-bundle.t
+++ b/tests/test-mq-pull-from-bundle.t
@@ -71,9 +71,9 @@ Clone base:
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 2 changes to 1 files
+  added 3 changesets with 3 changes to 2 files
   updating to branch default
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd copy
   $ hg qinit -c
 
@@ -116,9 +116,9 @@ Clone base again:
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 2 changes to 1 files
+  added 3 changesets with 3 changes to 2 files
   updating to branch default
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd copy2
   $ hg qinit -c
 
diff --git a/tests/test-mq-qdelete.t b/tests/test-mq-qdelete.t
--- a/tests/test-mq-qdelete.t
+++ b/tests/test-mq-qdelete.t
@@ -58,6 +58,10 @@ Delete the same patch twice in one comma
   $ hg qapplied
 
   $ hg log -G --template '{rev} {desc}\n'
+  o  3 [mq]: pc
+  |
+  o  2 [mq]: pb
+  |
   @  1 [mq]: pa
   |
   o  0 base
@@ -68,7 +72,7 @@ Delete the same patch twice in one comma
   $ hg qnew pf
 
   $ hg qdel -r pe
-  abort: cannot delete revision 3 above applied patches
+  abort: cannot delete revision 5 above applied patches
   [255]
 
   $ hg qdel -r qbase:pe
@@ -79,12 +83,16 @@ Delete the same patch twice in one comma
   pf
 
   $ hg log -G --template '{rev} {desc}\n'
-  @  4 [mq]: pf
+  @  6 [mq]: pf
   |
-  o  3 [mq]: pe
+  o  5 [mq]: pe
   |
-  o  2 [mq]: pd
+  o  4 [mq]: pd
   |
+  | o  3 [mq]: pc
+  | |
+  | o  2 [mq]: pb
+  |/
   o  1 [mq]: pa
   |
   o  0 base
@@ -127,6 +135,7 @@ Delete the same patch twice in one comma
   [255]
 
   $ hg qpush
+  (working directory not at a head)
   applying pc
   patch pc is empty
   now at: pc
@@ -139,8 +148,10 @@ Delete the same patch twice in one comma
   pc
 
   $ hg log -G --template '{rev} {desc}\n'
-  @  3 imported patch pc
+  @  4 imported patch pc
   |
+  | o  3 [mq]: pc
+  |/
   o  2 [mq]: pb
   |
   o  1 [mq]: pa
@@ -154,8 +165,10 @@ Delete the same patch twice in one comma
   $ hg qapplied
 
   $ hg log -G --template '{rev} {desc}\n'
-  @  3 imported patch pc
+  @  4 imported patch pc
   |
+  | o  3 [mq]: pc
+  |/
   o  2 [mq]: pb
   |
   o  1 [mq]: pa
@@ -194,7 +207,7 @@ resilience to inconsistency: qfinish -a 
   $ hg qrefresh -d '1 0'
   $ echo > .hg/patches/series # remove 3.diff from series to confuse mq
   $ hg qfinish -a
-  revision 47dfa8501675 refers to unknown patches: 3.diff
+  revision 4cb300ce2832 refers to unknown patches: 3.diff
 
 more complex state 'both known and unknown patches
 
@@ -208,7 +221,7 @@ more complex state 'both known and unkno
   $ echo pup > base
   $ hg qfinish -a
   warning: uncommitted changes in the working directory
-  revision 2b1c98802260 refers to unknown patches: 5.diff
-  revision 33a6861311c0 refers to unknown patches: 4.diff
+  revision 027d88f0e1ff refers to unknown patches: 5.diff
+  revision 8dc80595878f refers to unknown patches: 4.diff
 
   $ cd ..
diff --git a/tests/test-mq-qdiff.t b/tests/test-mq-qdiff.t
--- a/tests/test-mq-qdiff.t
+++ b/tests/test-mq-qdiff.t
@@ -56,6 +56,7 @@ qdiff filename:
   $ printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
   $ hg ci -Amlines -d '2 0'
   adding lines
+  created new head
 
   $ hg qnew -mmqbase2 mqbase2
   $ printf '\n\n1\n2\n3\n4\nhello  world\n     goodbye world\n7\n8\n9\n' > lines
diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t
--- a/tests/test-mq-qfold.t
+++ b/tests/test-mq-qfold.t
@@ -90,7 +90,7 @@ Fold git patch into a regular patch, exp
   $ cat .hg/patches/regular
   # HG changeset patch
   # Node ID 29f18cba15fbc2d0f714138c1cd740c245888702
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent 9bafeb9db148dcb2848bf61f0b22c806a8b0f3f4
   # Date 1 0
   
   diff --git a/a b/a
@@ -134,7 +134,7 @@ Fold regular patch into a git patch, exp
   $ cat .hg/patches/git
   # HG changeset patch
   # Node ID 53c931819af246e79976515bac260ad86fc7ddc9
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent 9bafeb9db148dcb2848bf61f0b22c806a8b0f3f4
   # Date 1 0
   
   diff --git a/a b/aa
diff --git a/tests/test-mq-qgoto.t b/tests/test-mq-qgoto.t
--- a/tests/test-mq-qgoto.t
+++ b/tests/test-mq-qgoto.t
@@ -29,6 +29,7 @@
   now at: a.patch
 
   $ hg qgoto c.patch
+  (working directory not at a head)
   applying b.patch
   applying c.patch
   now at: c.patch
@@ -44,6 +45,7 @@ Using index:
   now at: a.patch
 
   $ hg qgoto 2
+  (working directory not at a head)
   applying b.patch
   applying c.patch
   now at: c.patch
@@ -79,6 +81,7 @@ changes in unrelated files:
   $ hg up -qCr.
 
   $ hg qgoto 3
+  (working directory not at a head)
   applying c.patch
   applying bug314159
   now at: bug314159
diff --git a/tests/test-mq-qimport.t b/tests/test-mq-qimport.t
--- a/tests/test-mq-qimport.t
+++ b/tests/test-mq-qimport.t
@@ -128,6 +128,7 @@ import patch that already exists
   abort: patch "url.diff" already exists
   [255]
   $ hg qpush
+  (working directory not at a head)
   applying url.diff
   now at: url.diff
   $ cat foo
@@ -141,6 +142,7 @@ qimport -f
   $ hg qimport -f ../url.diff
   adding url.diff to series file
   $ hg qpush
+  (working directory not at a head)
   applying url.diff
   now at: url.diff
   $ cat foo
@@ -154,6 +156,7 @@ build diff with CRLF
   $ python ../writelines.py b 5 'a\n' 5 'a\r\n'
   $ hg ci -Am addb
   adding b
+  created new head
   $ python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
   $ echo 'Date: 0 0' > b.diff
   $ hg diff >> b.diff
@@ -201,32 +204,32 @@ try to import --push
   now at: appendbar.diff
   $ hg qfin -a
   patch b.diff finalized without changeset message
-  $ touch .hg/patches/2.diff
+  $ touch .hg/patches/5.diff
   $ hg qimport -r 'p1(.)::'
-  abort: patch "2.diff" already exists
+  abort: patch "5.diff" already exists
   [255]
   $ hg qapplied
-  3.diff
+  6.diff
   $ hg qfin -a
-  $ rm .hg/patches/2.diff
+  $ rm .hg/patches/5.diff
   $ hg qimport -r 'p1(.)::' -P
   $ hg qpop -a
-  popping 3.diff
-  popping 2.diff
+  popping 6.diff
+  popping 5.diff
   patch queue now empty
-  $ hg qdel 3.diff
-  $ hg qdel -k 2.diff
+  $ hg qdel 6.diff
+  $ hg qdel -k 5.diff
 
 qimport -e
 
-  $ hg qimport -e 2.diff
-  adding 2.diff to series file
-  $ hg qdel -k 2.diff
+  $ hg qimport -e 5.diff
+  adding 5.diff to series file
+  $ hg qdel -k 5.diff
 
 qimport -e --name newname oldexisitingpatch
 
-  $ hg qimport -e --name this-name-is-better 2.diff
-  renaming 2.diff to this-name-is-better
+  $ hg qimport -e --name this-name-is-better 5.diff
+  renaming 5.diff to this-name-is-better
   adding this-name-is-better to series file
   $ hg qser
   this-name-is-better
@@ -234,8 +237,8 @@ qimport -e --name newname oldexisitingpa
 
 qimport -e --name without --force
 
-  $ cp .hg/patches/this-name-is-better .hg/patches/3.diff
-  $ hg qimport -e --name this-name-is-better 3.diff
+  $ cp .hg/patches/this-name-is-better .hg/patches/6.diff
+  $ hg qimport -e --name this-name-is-better 6.diff
   abort: patch "this-name-is-better" already exists
   [255]
   $ hg qser
@@ -244,8 +247,8 @@ qimport -e --name without --force
 
 qimport -e --name with --force
 
-  $ hg qimport --force -e --name this-name-is-better 3.diff
-  renaming 3.diff to this-name-is-better
+  $ hg qimport --force -e --name this-name-is-better 6.diff
+  renaming 6.diff to this-name-is-better
   adding this-name-is-better to series file
   $ hg qser
   this-name-is-better
@@ -274,21 +277,22 @@ set up hgweb
   $ hg qimport http://localhost:$HGPORT/raw-rev/0///
   adding 0 to series file
 
-check qimport phase:
+check qimport phase - temporarily broken until we make non-stripped old
+changesets "go away":
 
-  $ hg -q qpush
-  now at: 0
-  $ hg phase qparent
-  1: draft
-  $ hg qimport -r qparent
-  $ hg phase qbase
-  1: draft
-  $ hg qfinish qbase
-  $ echo '[mq]' >> $HGRCPATH
-  $ echo 'secret=true' >> $HGRCPATH
-  $ hg qimport -r qparent
-  $ hg phase qbase
-  1: secret
+# $ hg -q qpush
+# now at: 0
+# $ hg phase qparent
+# 1: draft
+# $ hg qimport -r qparent
+# $ hg phase qbase
+# 1: draft
+# $ hg qfinish qbase
+# $ echo '[mq]' >> $HGRCPATH
+# $ echo 'secret=true' >> $HGRCPATH
+# $ hg qimport -r qparent
+# $ hg phase qbase
+# 1: secret
 
   $ cd ..
 
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -142,6 +142,7 @@ plain headers
   popping uncommitted.patch
   patch queue now empty
   adding d/b
+  created new head
   M d/b
   Date: 1 0
   
@@ -219,6 +220,7 @@ hg headers
   popping uncommitted.patch
   patch queue now empty
   adding d/b
+  created new head
   M d/b
   # HG changeset patch
   # Node ID 59c3a3ccb3ed4f7be5da6cf407b050db5ce3070c
diff --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t
--- a/tests/test-mq-qpush-fail.t
+++ b/tests/test-mq-qpush-fail.t
@@ -38,17 +38,15 @@ test qpush on empty series
   $ cat .hg/patches/bad-patch >> message
   $ mv message .hg/patches/bad-patch
   $ hg qpush -a && echo 'qpush succeeded?!'
+  (working directory not at a head)
   applying patch1
   applying patch2
   applying bad-patch
-  transaction abort!
-  rollback completed
   cleaning up working directory...done
   abort: decoding near '\xe9': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! (esc)
   [255]
   $ hg parents
   changeset:   0:bbd179dfa0a7
-  tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     add foo
@@ -56,6 +54,7 @@ test qpush on empty series
 
 test corrupt status file
   $ hg qpush
+  (working directory not at a head)
   applying patch1
   now at: patch1
   $ cp .hg/patches/status .hg/patches/status.orig
@@ -64,6 +63,7 @@ test corrupt status file
   patch queue now empty
   $ cp .hg/patches/status.orig .hg/patches/status
   $ hg qpush
+  (working directory not at a head)
   abort: working directory revision is not qtip
   [255]
   $ rm .hg/patches/status .hg/patches/status.orig
@@ -81,6 +81,7 @@ preparing qpush of a missing patch
   $ hg qpop -a
   no patches applied
   $ hg qpush
+  (working directory not at a head)
   applying patch1
   now at: patch1
   $ rm .hg/patches/patch2
@@ -88,6 +89,7 @@ preparing qpush of a missing patch
 now we expect the push to fail, but it should NOT complain about patch1
 
   $ hg qpush
+  (working directory not at a head)
   applying patch2
   unable to read patch2
   now at: patch1
@@ -103,6 +105,7 @@ preparing qpush of missing patch with no
 qpush should fail the same way as below
 
   $ hg qpush
+  (working directory not at a head)
   applying patch1
   unable to read patch1
   [1]
@@ -124,9 +127,11 @@ Test qpush to a patch below the currentl
 try to push and pop while a is guarded
 
   $ hg qpush a
+  (working directory not at a head)
   cannot push 'a' - guarded by '+block'
   [1]
   $ hg qpush -a
+  (working directory not at a head)
   applying b
   patch b is empty
   applying c
@@ -149,6 +154,7 @@ and now we try it one more time with a u
   popping c
   now at: b
   $ hg qpush a
+  (working directory not at a head)
   abort: cannot push to a previous patch: a
   [255]
 
@@ -162,6 +168,7 @@ test qpop --force and backup files
   $ echo b > b
   $ echo c > c
   $ hg ci -Am add a b c
+  created new head
   $ echo a >> a
   $ hg rm b
   $ hg rm c
@@ -194,6 +201,7 @@ test qpop --force and backup files
 test qpop --force --no-backup
 
   $ hg qpush
+  (working directory not at a head)
   applying p1
   now at: p1
   $ rm a.orig
@@ -207,6 +215,7 @@ test qpop --force --no-backup
 test qpop --keep-changes
 
   $ hg qpush
+  (working directory not at a head)
   applying p1
   now at: p1
   $ hg qpop --keep-changes --force
@@ -260,6 +269,7 @@ test qpush --force and backup files
   $ hg add d
   $ echo e1 > e
   $ hg qpush -a --force --verbose
+  (working directory not at a head)
   applying p2
   saving current version of a as a.orig
   patching file a
@@ -299,6 +309,7 @@ test qpush --force --no-backup
   $ echo a >> a
   $ rm a.orig
   $ hg qpush --force --no-backup --verbose
+  (working directory not at a head)
   applying p2
   patching file a
   a
@@ -313,6 +324,7 @@ test qgoto --force --no-backup
   patch queue now empty
   $ echo a >> a
   $ hg qgoto --force --no-backup p2 --verbose
+  (working directory not at a head)
   applying p2
   patching file a
   a
@@ -330,16 +342,19 @@ test qpush --keep-changes
   [255]
   $ echo b >> b
   $ hg qpush --keep-changes
+  (working directory not at a head)
   applying p3
   errors during apply, please fix and refresh p2
   [2]
   $ rm b
   $ hg qpush --keep-changes
+  (working directory not at a head)
   applying p3
   errors during apply, please fix and refresh p2
   [2]
   $ hg rm -A b
   $ hg qpush --keep-changes
+  (working directory not at a head)
   applying p3
   errors during apply, please fix and refresh p2
   [2]
@@ -347,6 +362,7 @@ test qpush --keep-changes
   $ echo d > d
   $ hg add d
   $ hg qpush --keep-changes
+  (working directory not at a head)
   applying p3
   errors during apply, please fix and refresh p2
   [2]
@@ -357,6 +373,7 @@ test qpush --keep-changes
   patch queue now empty
   $ echo b >> b
   $ hg qpush -a --keep-changes
+  (working directory not at a head)
   applying p2
   applying p3
   errors during apply, please fix and refresh p2
@@ -364,7 +381,7 @@ test qpush --keep-changes
   $ hg qtop
   p2
   $ hg parents --template "{rev} {desc}\n"
-  3 imported patch p2
+  19 imported patch p2
   $ hg st b
   M b
   $ cat b
@@ -393,6 +410,7 @@ test qgoto --keep-changes
 test mq.keepchanges setting
 
   $ hg --config mq.keepchanges=1 qpush
+  (working directory not at a head)
   applying p3
   now at: p3
   $ hg st a
@@ -403,6 +421,7 @@ test mq.keepchanges setting
   $ hg st a
   M a
   $ hg --config mq.keepchanges=1 qgoto p3
+  (working directory not at a head)
   applying p3
   now at: p3
   $ hg st a
@@ -421,6 +440,7 @@ test mq.keepchanges setting
   patch queue now empty
   $ echo a >> a
   $ hg --config mq.keepchanges=1 qpush --force
+  (working directory not at a head)
   applying p2
   now at: p2
   $ hg st a
diff --git a/tests/test-mq-safety.t b/tests/test-mq-safety.t
--- a/tests/test-mq-safety.t
+++ b/tests/test-mq-safety.t
@@ -46,6 +46,7 @@ Try to operate on public mq changeset
 restore state for remaining test
 
   $ hg qpush
+  (working directory not at a head)
   applying bar
   now at: bar
 
@@ -67,11 +68,12 @@ cheat a bit...
 qpop/qrefresh on the wrong revision
 
   $ hg qpop
-  abort: popping would remove a revision not managed by this patch queue
-  [255]
+  popping bar
+  now at: foo
   $ hg qpop -n patches
   using patch queue: $TESTTMP/repo/.hg/patches (glob)
-  abort: popping would remove a revision not managed by this patch queue
+  abort: popping would remove an immutable revision
+  (see "hg help phases" for details)
   [255]
   $ hg qrefresh
   abort: working directory revision is not qtip
@@ -80,10 +82,12 @@ qpop/qrefresh on the wrong revision
   $ hg up -C qtip
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg qpop
-  abort: popping would remove a revision not managed by this patch queue
+  abort: popping would remove an immutable revision
+  (see "hg help phases" for details)
   [255]
   $ hg qrefresh
-  abort: cannot refresh a revision with children
+  abort: cannot refresh immutable revision
+  (see "hg help phases" for details)
   [255]
   $ hg tip --template '{rev} {desc}\n'
   5 append quux
@@ -103,6 +107,7 @@ qpush warning branchheads
   $ echo a > a
   $ hg ci -Ama
   adding a
+  created new head
   $ hg up null
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg branch b
@@ -118,27 +123,33 @@ qpush warning branchheads
   $ hg up default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg log -G
-  o    changeset:   2:65309210bf4e
+  o    changeset:   3:65309210bf4e
   |\   branch:      b
   | |  tag:         tip
-  | |  parent:      1:707adb4c8ae1
-  | |  parent:      0:cb9a9f314b8b
+  | |  parent:      2:707adb4c8ae1
+  | |  parent:      1:cb9a9f314b8b
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  summary:     merge
   | |
-  | o  changeset:   1:707adb4c8ae1
+  | o  changeset:   2:707adb4c8ae1
   |    branch:      b
   |    parent:      -1:000000000000
   |    user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000
   |    summary:     c
   |
-  @  changeset:   0:cb9a9f314b8b
+  @  changeset:   1:cb9a9f314b8b
+     parent:      -1:000000000000
      user:        test
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     a
   
+  o  changeset:   0:151d177ebcf4
+     user:        test
+     date:        Thu Jan 01 00:00:01 1970 +0000
+     summary:     [mq]: qp
+  
   $ hg qpush
   applying qp
   now at: qp
diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t
--- a/tests/test-mq-subrepo.t
+++ b/tests/test-mq-subrepo.t
@@ -256,12 +256,14 @@ qpush
   $ hg -R sub update 0000
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg qpush
+  (working directory not at a head)
   abort: local changed subrepos found, refresh first
   [255]
   $ hg revert sub
   reverting subrepo sub
   adding sub/a
   $ hg qpush
+  (working directory not at a head)
   applying 1.diff
    subrepository sub diverged (local revision: b2fdb12cd82b, remote revision: aa037b301eba)
   (M)erge, keep (l)ocal or keep (r)emote? m
@@ -460,6 +462,7 @@ check whether qrefresh imports updated .
   popping import-at-qnew
   patch queue now empty
   $ hg qpush
+  (working directory not at a head)
   applying import-at-qnew
   now at: import-at-qnew
   $ hg parents --template '{files}\n'
@@ -535,12 +538,13 @@ check whether qrefresh imports updated .
   $ echo 'sub = sub' > .hgsub
   $ hg commit -Am '#1 in parent'
   adding .hgsub
+  created new head
   $ hg -R sub update -C 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg commit -Am '#2 in parent (but will be rolled back soon)'
   $ hg rollback
-  repository tip rolled back to revision 1 (undo commit)
-  working directory now based on revision 1
+  repository tip rolled back to revision 5 (undo commit)
+  working directory now based on revision 5
   $ hg status
   M .hgsubstate
   $ hg qnew -u test -d '0 0' checkstate-at-qnew
diff --git a/tests/test-mq-symlinks.t b/tests/test-mq-symlinks.t
--- a/tests/test-mq-symlinks.t
+++ b/tests/test-mq-symlinks.t
@@ -30,6 +30,7 @@ test replacing a file with a symlink
   popping symlink.patch
   now at: base.patch
   $ hg qpush
+  (working directory not at a head)
   applying symlink.patch
   now at: symlink.patch
   $ "$TESTDIR/readlink.py" a
@@ -47,6 +48,7 @@ test updating a symlink
   popping updatelink
   now at: symlink.patch
   $ hg qpush --debug
+  (working directory not at a head)
   applying updatelink
   patching file a
   a
@@ -69,6 +71,7 @@ test replacing a symlink with a file
   popping replacelinkwithfile
   now at: addlink
   $ hg qpush
+  (working directory not at a head)
   applying replacelinkwithfile
   now at: replacelinkwithfile
   $ cat s
@@ -85,6 +88,7 @@ test symlink removal
   popping removesl.patch
   now at: replacelinkwithfile
   $ hg qpush
+  (working directory not at a head)
   applying removesl.patch
   now at: removesl.patch
   $ hg st -c
@@ -105,6 +109,7 @@ replace broken symlink with another brok
   popping movelink
   now at: link
   $ hg qpush
+  (working directory not at a head)
   applying movelink
   now at: movelink
   $ "$TESTDIR/readlink.py" linkb
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -366,6 +366,7 @@ pop/push -a in subdir
   popping test.patch
   patch queue now empty
   $ hg --traceback qpush -a
+  (working directory not at a head)
   applying test.patch
   applying test2.patch
   now at: test2.patch
@@ -388,6 +389,7 @@ setting columns & formatted tests trunca
   $ hg sum | grep mq
   mq:     1 applied, 1 unapplied
   $ hg qpush
+  (working directory not at a head)
   applying test2.patch
   now at: test2.patch
   $ hg sum | grep mq
@@ -468,6 +470,7 @@ qpush/qpop with index
   popping test1b.patch
   now at: test.patch
   $ hg qpush test.patch+1
+  (working directory not at a head)
   applying test1b.patch
   now at: test1b.patch
   $ hg qpush test.patch+2
@@ -480,6 +483,7 @@ qpush/qpop with index
   popping test1b.patch
   now at: test.patch
   $ hg qpush test1b.patch+1
+  (working directory not at a head)
   applying test1b.patch
   applying test2.patch
   now at: test2.patch
@@ -495,11 +499,13 @@ qpush --move
   $ hg qguard test1b.patch -- -negguard
   $ hg qguard test2.patch -- +posguard
   $ hg qpush --move test2.patch # can't move guarded patch
+  (working directory not at a head)
   cannot push 'test2.patch' - guarded by '+posguard'
   [1]
   $ hg qselect posguard
   number of unguarded, unapplied patches has changed from 2 to 3
   $ hg qpush --move test2.patch # move to front
+  (working directory not at a head)
   applying test2.patch
   now at: test2.patch
   $ hg qpush --move test1b.patch # negative guard unselected
@@ -526,18 +532,23 @@ cleaning up
   $ hg qguard --none test1b.patch
   $ hg qguard --none test2.patch
   $ hg qpush --move test.patch
+  (working directory not at a head)
   applying test.patch
   now at: test.patch
   $ hg qpush --move test1b.patch
+  (working directory not at a head)
   applying test1b.patch
   now at: test1b.patch
   $ hg qpush --move bogus # nonexistent patch
+  (working directory not at a head)
   abort: patch bogus not in series
   [255]
   $ hg qpush --move # no patch
+  (working directory not at a head)
   abort: please specify the patch to move
   [255]
   $ hg qpush --move test.patch # already applied
+  (working directory not at a head)
   abort: cannot push to a previous patch: test.patch
   [255]
   $ sed '2i\
@@ -552,6 +563,7 @@ cleaning up
   test1b.patch
   test2.patch
   $ hg qpush --move test2.patch
+  (working directory not at a head)
   applying test2.patch
   now at: test2.patch
 
@@ -661,6 +673,7 @@ qapplied -1
   no patches applied
   [1]
   $ hg qpush
+  (working directory not at a head)
   applying test.patch
   now at: test.patch
 
@@ -682,6 +695,7 @@ push should succeed
 we want to start with some patches applied
 
   $ hg qpush -a
+  (working directory not at a head)
   applying test.patch
   applying test1b.patch
   applying test2.patch
@@ -709,6 +723,7 @@ we want to start with some patches appli
 % pushes a patch and succeeds
 
   $ hg qpush
+  (working directory not at a head)
   applying test.patch
   now at: test.patch
 
@@ -721,6 +736,7 @@ we want to start with some patches appli
 % pushes up to test1b.patch and succeeds
 
   $ hg qpush test1b.patch
+  (working directory not at a head)
   applying test.patch
   applying test1b.patch
   now at: test1b.patch
@@ -728,6 +744,7 @@ we want to start with some patches appli
 % does nothing and succeeds
 
   $ hg qpush test1b.patch
+  (working directory not at a head)
   qpush: test1b.patch is already at the top
 
 % does nothing and succeeds
@@ -738,6 +755,7 @@ we want to start with some patches appli
 % fails - can't push to this patch
 
   $ hg qpush test.patch
+  (working directory not at a head)
   abort: cannot push to a previous patch: test.patch
   [255]
 
@@ -756,6 +774,7 @@ we want to start with some patches appli
 % pushes all patches and succeeds
 
   $ hg qpush -a
+  (working directory not at a head)
   applying test1b.patch
   applying test2.patch
   now at: test2.patch
@@ -875,6 +894,7 @@ qpush failure
   patch queue now empty
   $ echo bar > foo
   $ hg qpush -a
+  (working directory not at a head)
   applying foo
   applying bar
   file foo already exists
@@ -891,9 +911,11 @@ qpush failure
 mq tags
 
   $ hg log -G --template '{rev} {tags}\n' -r qparent:qtip
-  @  5 bar qtip tip
+  @  7 bar qtip tip
   |
-  x  4 foo qbase
+  | o  6
+  |/
+  x  3 foo qbase
   |
   o  0 qparent
   
@@ -901,9 +923,9 @@ mq tags
 mq revset
 
   $ hg log -G -r 'mq()' --template '{rev}\n'
-  @  5
+  @  7
   |
-  x  4
+  x  3
   |
   $ hg help revsets | grep -i mq
       "mq()"
@@ -916,17 +938,18 @@ bad node in status
   now at: foo
   $ hg strip -qn tip
   $ hg tip
-  changeset:   0:cb9a9f314b8b
+  changeset:   6:7d7db93e234f
   tag:         tip
+  parent:      3:1867c5495ebc
   user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     a
+  date:        Thu Jan 01 00:00:01 1970 +0000
+  summary:     bar
   
   $ hg branches
-  default                        0:cb9a9f314b8b
+  default                        6:7d7db93e234f
   $ hg qpop
-  no patches applied
-  [1]
+  popping foo
+  patch queue now empty
 
   $ cd ..
 
@@ -990,6 +1013,7 @@ git patches
   popping copy
   now at: new
   $ hg qpush
+  (working directory not at a head)
   applying copy
   now at: copy
   $ hg qdiff
@@ -1185,6 +1209,7 @@ check binary patches can be popped and p
   $ test -f bucephalus && echo % bucephalus should not be there
   [1]
   $ hg qpush
+  (working directory not at a head)
   applying addbucephalus
   now at: addbucephalus
   $ test -f bucephalus
@@ -1325,6 +1350,7 @@ repo with patches unapplied
   patch queue now empty
   $ qlog
   main repo:
+      rev 2: change foo
       rev 0: add foo
   patch repo:
       rev 0: checkpoint
@@ -1334,13 +1360,14 @@ repo with patches unapplied
   adding changesets
   adding manifests
   adding file changes
-  added 1 changesets with 1 changes to 1 files
+  added 2 changesets with 2 changes to 1 files
   updating to branch default
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd qclonedest2
   $ qlog
   main repo:
+      rev 1: change foo
       rev 0: add foo
   patch repo:
       rev 0: checkpoint
@@ -1360,6 +1387,7 @@ Issue1033: test applying on an empty fil
   popping changea
   patch queue now empty
   $ hg qpush
+  (working directory not at a head)
   applying changea
   now at: changea
   $ cd ..
@@ -1383,6 +1411,7 @@ test qpush with --force, issue1087
 qpush should fail, local changes
 
   $ hg qpush
+  (working directory not at a head)
   abort: local changes found
   [255]
 
@@ -1390,6 +1419,7 @@ qpush should fail, local changes
 apply force, should not discard changes with empty patch
 
   $ hg qpush -f
+  (working directory not at a head)
   applying empty
   patch empty is empty
   now at: empty
@@ -1408,11 +1438,12 @@ apply force, should not discard changes 
    hello
   +world
   $ hg log -l1 -p
-  changeset:   1:d58265112590
+  changeset:   2:d58265112590
   tag:         empty
   tag:         qbase
   tag:         qtip
   tag:         tip
+  parent:      0:9ecee4f634e3
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     imported patch empty
@@ -1429,6 +1460,7 @@ apply force, should not discard changes 
 qpush should fail, local changes
 
   $ hg qpush
+  (working directory not at a head)
   abort: local changes found
   [255]
 
@@ -1436,6 +1468,7 @@ qpush should fail, local changes
 apply force, should discard changes in hello, but not bye
 
   $ hg qpush -f --verbose
+  (working directory not at a head)
   applying empty
   saving current version of hello.txt as hello.txt.orig
   patching file hello.txt
@@ -1538,6 +1571,7 @@ insensitive filesystem is not enough:
 (2) patching fails in modification of (1) files
 
   $ hg qpush -a
+  (working directory not at a head)
   applying add-file1
   applying add-file2
   applying modify-file
@@ -1548,11 +1582,21 @@ Proper phase default with mq:
 1. mq.secret=false
 
   $ hg log -G --hidden -T '{rev}  {tags}  {desc|firstline}\n'
-  @  3  modify-file qtip tip  imported patch modify-file
+  @  8  modify-file qtip tip  imported patch modify-file
   |
-  o  2  add-file2  imported patch add-file2
+  o  7  add-file2  imported patch add-file2
   |
-  o  1  add-file1 qbase  imported patch add-file1
+  o  6  add-file1 qbase  imported patch add-file1
+  
+  o  5    [mq]: modify-file
+  |
+  | x  4    [mq]: modify-file
+  |/
+  o  3    [mq]: add-file2
+  |
+  | x  2    [mq]: add-file2
+  |/
+  o  1    [mq]: add-file1
   
   x  0    [mq]: add-file1
   
@@ -1560,17 +1604,27 @@ 1. mq.secret=false
   $ rm .hg/store/phaseroots
   $ hg phase 'qparent::'
   0: public
-  1: draft
-  2: draft
-  3: draft
+  1: public
+  2: public
+  3: public
+  4: public
+  5: public
+  6: draft
+  7: draft
+  8: draft
   $ echo '[mq]' >> $HGRCPATH
   $ echo 'secret=true' >> $HGRCPATH
   $ rm -f .hg/store/phaseroots
   $ hg phase 'qparent::'
   0: public
-  1: secret
-  2: secret
-  3: secret
+  1: public
+  2: public
+  3: public
+  4: public
+  5: public
+  6: secret
+  7: secret
+  8: secret
 
 Test that qfinish change phase when mq.secret=true
 
@@ -1578,9 +1632,14 @@ Test that qfinish change phase when mq.s
   patch add-file1 finalized without changeset message
   $ hg phase 'all()'
   0: public
-  1: draft
-  2: secret
-  3: secret
+  1: public
+  2: public
+  3: public
+  4: public
+  5: public
+  6: draft
+  7: secret
+  8: secret
 
 Test that qfinish respect phases.new-commit setting
 
@@ -1590,9 +1649,14 @@ Test that qfinish respect phases.new-com
   patch add-file2 finalized without changeset message
   $ hg phase 'all()'
   0: public
-  1: draft
-  2: secret
-  3: secret
+  1: public
+  2: public
+  3: public
+  4: public
+  5: public
+  6: draft
+  7: secret
+  8: secret
 
 (restore env for next test)
 
@@ -1608,9 +1672,14 @@ Test that qfinish preserve phase when mq
   patch add-file2 finalized without changeset message
   $ hg phase 'all()'
   0: public
-  1: draft
-  2: secret
-  3: secret
+  1: public
+  2: public
+  3: public
+  4: public
+  5: public
+  6: draft
+  7: secret
+  8: secret
 
 Test that secret mq patch does not break hgweb
 
diff --git a/tests/test-mq2.t b/tests/test-mq2.t
--- a/tests/test-mq2.t
+++ b/tests/test-mq2.t
@@ -63,12 +63,15 @@
   3506c28d72aa3a31f8ce50ca4cfcb812af131450:b
 
   $ hg log -G --template "{rev} {node|short} {phase} {desc|firstline}\n"
+  o  3 757e6e08e7eb draft a2
+  |
   @  2 3506c28d72aa draft b
   |
   o  0 cb9a9f314b8b draft a
   
 
   $ hg qpush
+  (working directory not at a head)
   applying a2
   now at: a2
 
@@ -90,10 +93,15 @@
   patch queue now empty
   $ sed -i 1iyada a
   $ hg ci -m yada
+  created new head
 
   $ hg log -G --template "{rev} {node|short} {phase} {desc|firstline}\n"
-  @  2 dfa6dafa9c6c draft yada
+  @  4 dfa6dafa9c6c draft yada
   |
+  | o  3 757e6e08e7eb draft a2
+  | |
+  | o  2 3506c28d72aa draft b
+  |/
   o  0 cb9a9f314b8b draft a
   
 
@@ -131,12 +139,16 @@
   applying a2
   now at: a2
   $ hg log -G --template "{rev} {node|short} {phase} {desc|firstline}\n"
-  @  4 cd192c2f0104 draft a2
+  @  6 cd192c2f0104 draft a2
   |
-  o  3 c27d00b1f47f draft b
+  o  5 c27d00b1f47f draft b
   |
-  o  2 dfa6dafa9c6c draft yada
+  o  4 dfa6dafa9c6c draft yada
   |
+  | o  3 757e6e08e7eb draft a2
+  | |
+  | o  2 3506c28d72aa draft b
+  |/
   o  0 cb9a9f314b8b draft a
   
 
@@ -151,7 +163,15 @@
   $ hg qrm a2
 (should also have stripped b that couldn't be stripped before)
   $ hg log -G --template "{rev} {node|short} {phase} {desc|firstline}\n"
-  @  2 dfa6dafa9c6c draft yada
+  o  6 cd192c2f0104 draft a2
   |
+  o  5 c27d00b1f47f draft b
+  |
+  @  4 dfa6dafa9c6c draft yada
+  |
+  | o  3 757e6e08e7eb draft a2
+  | |
+  | o  2 3506c28d72aa draft b
+  |/
   o  0 cb9a9f314b8b draft a
   


More information about the Mercurial-devel mailing list