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

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 12, 2013, 7:22 p.m.
Message ID <cb128d39bedffcee8b8f.1358018568@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/574/
State Accepted
Commit de99de39ba28857437025f9b05d18f8b37cd800e
Headers show

Comments

Mads Kiilerich - Jan. 12, 2013, 7:22 p.m.
# HG changeset patch
# User Mads Kiilerich <mads@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
Mads Kiilerich - Jan. 15, 2013, 12:43 a.m.
Mads Kiilerich wrote, On 01/12/2013 08:22 PM:
> # HG changeset patch
> # User Mads Kiilerich <mads@kiilerich.com>
> # Date 1358017511 -3600
> # Node ID cb128d39bedffcee8b8f5db863cb0a05276bbb73
> # Parent  4e27b06a0fd9368170ab3216cccd93ee6a02826d
> mq: fix qpop of working directory parent patch when not at qtip

Series crewed.

/Mads

Patch

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