Patchwork [6,of,9,standalone-strip] mq: drop the use of mq.queue.qparent in mq.strip

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 25, 2013, 9:26 p.m.
Message ID <239e85092f78362cf095.1380144409@vulgaris>
Download mbox | patch
Permalink /patch/2635/
State Accepted
Commit e67786965af23b920548ed4e880fcd897a30c36d
Headers show

Comments

Pierre-Yves David - Sept. 25, 2013, 9:26 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1380111034 -7200
#      Wed Sep 25 14:10:34 2013 +0200
# Node ID 239e85092f78362cf095d3cd5285aa9df80f22c3
# Parent  afc02cb343a84c3d4cc170f14a434e82af1e1339
mq: drop the use of mq.queue.qparent in mq.strip

In this case, rev is never `None`. We can just copy the two relevant lines in
in `strip`. This help having `strip` independent from `queue` one
further step toward its extraction in an independent extension. (As
discussed in issue3824).

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3060,11 +3060,13 @@  def strip(ui, repo, *revs, **opts):
 
     revs = sorted(rootnodes)
     if update and opts.get('keep'):
         wlock = repo.wlock()
         try:
-            urev = repo.mq.qparents(repo, revs[0])
+            urev, p2 = repo.changelog.parents(revs[0])
+            if p2 != nullid and p2 in [x.node for x in repo.mq.applied]:
+                urev = p2
             uctx = repo[urev]
 
             # only reset the dirstate for files that would actually change
             # between the working context and uctx
             descendantrevs = repo.revs("%s::." % uctx.rev())