mq: fix qpop of working directory parent patch when not at qtip
authorMads Kiilerich <mads@kiilerich.com>
Tue, 15 Jan 2013 01:05:12 +0100
changeset 18342 de99de39ba28
parent 18341 ed23d6100dd3
child 18343 cfa731b45b75
mq: fix qpop of working directory parent patch when not at qtip mq assumed that it had to update from qtip to qparent, and instead of updating from where it was it failed with: abort: working directory revision is not qtip
hgext/mq.py
tests/test-mq-qgoto.t
--- a/hgext/mq.py	Tue Jan 15 01:05:12 2013 +0100
+++ b/hgext/mq.py	Tue Jan 15 01:05:12 2013 +0100
@@ -1406,8 +1406,6 @@
             self.applieddirty = True
             end = len(self.applied)
             rev = self.applied[start].node
-            if update:
-                top = self.checktoppatch(repo)[0]
 
             try:
                 heads = repo.changelog.heads(rev)
@@ -1428,7 +1426,7 @@
             if update:
                 qp = self.qparents(repo, rev)
                 ctx = repo[qp]
-                m, a, r, d = repo.status(qp, top)[:4]
+                m, a, r, d = repo.status(qp, '.')[:4]
                 if d:
                     raise util.Abort(_("deletions found between repo revs"))
 
--- a/tests/test-mq-qgoto.t	Tue Jan 15 01:05:12 2013 +0100
+++ b/tests/test-mq-qgoto.t	Tue Jan 15 01:05:12 2013 +0100
@@ -46,20 +46,35 @@
   applying c.patch
   now at: c.patch
 
-No warnings when using index:
+No warnings when using index ... and update from non-qtip and with pending
+changes in unrelated files:
 
   $ hg qnew bug314159
   $ echo d >> c
   $ hg qrefresh
   $ hg qnew bug141421
-  $ echo e >> c
+  $ echo e >> b
   $ hg qrefresh
 
+  $ hg up -r bug314159
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo f >> a
+  $ echo f >> b
+  $ echo f >> c
+
   $ hg qgoto 1
+  abort: local changes found, refresh first
+  [255]
+  $ hg qgoto 1 -f
   popping bug141421
   popping bug314159
   popping c.patch
   now at: b.patch
+  $ hg st
+  M a
+  M b
+  ? c.orig
+  $ hg up -qCr.
 
   $ hg qgoto 3
   applying c.patch