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

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 25, 2013, 9:26 p.m.
Message ID <b85be8af20fcedd3127f.1380144410@vulgaris>
Download mbox | patch
Permalink /patch/2636/
State Accepted
Commit f72b513ad234a3c3e56b025a6e7febbb0e3cc828
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 1380109303 -7200
#      Wed Sep 25 13:41:43 2013 +0200
# Node ID b85be8af20fcedd3127f9077e022368a4a1cbc1f
# Parent  239e85092f78362cf095d3cd5285aa9df80f22c3
mq: drop the use of mq.queue.qparent in mq.queue.strip

Same as in the previous changeset, rev is never `None`. We can just copy the two
relevant lines in in `queue.strip`. This help having `queue.strip` independent
from `queue`. One further step toward the extraction of `strip` 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
@@ -1109,11 +1109,13 @@  class queue(object):
             wlock = repo.wlock()
             lock = repo.lock()
 
             if update:
                 checklocalchanges(repo, force=force)
-                urev = self.qparents(repo, revs[0])
+                urev, p2 = repo.changelog.parents(revs[0])
+                if p2 != nullid and p2 in [x.node for x in self.applied]:
+                    urev = p2
                 hg.clean(repo, urev)
                 repo.dirstate.write()
 
             repair.strip(self.ui, repo, revs, backup)
         finally: