[PATCH 1 of 2] mq: fix qpop of working directory parent patch when not at qtip

Mads Kiilerich mads at kiilerich.com
Sat Jan 12 19:22:48 UTC 2013


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1358017511 -3600
# Node ID cb128d39bedffcee8b8f5db863cb0a05276bbb73
# Parent  4e27b06a0fd9368170ab3216cccd93ee6a02826d
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

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1406,8 +1406,6 @@ class queue(object):
             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 @@ class queue(object):
             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"))
 
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
@@ -46,20 +46,35 @@ Using index:
   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


More information about the Mercurial-devel mailing list