changeset 19820:8cf0e2c32901

mq: have the strip command functionnal on repo without mq This is the last step before being able to extract `strip` in its own extension. The changes are made in mq to allow a move only extraction without touching a line of code.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 25 Sep 2013 14:16:51 +0200
parents f0fc4d5797e1
children baab785e3ecf
files hgext/mq.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Sep 25 14:07:37 2013 +0200
+++ b/hgext/mq.py	Wed Sep 25 14:16:51 2013 +0200
@@ -3042,8 +3042,8 @@
 
     rootnodes = set(cl.node(r) for r in roots)
 
-    q = repo.mq
-    if q.applied:
+    q = getattr(repo, 'mq', None)
+    if q is not None and q.applied:
         # refresh queue state if we're about to strip
         # applied patches
         if cl.rev(repo.lookup('qtip')) in strippedrevs:
@@ -3064,7 +3064,8 @@
         wlock = repo.wlock()
         try:
             urev, p2 = repo.changelog.parents(revs[0])
-            if p2 != nullid and p2 in [x.node for x in repo.mq.applied]:
+            if (util.safehasattr(repo, 'mq') and p2 != nullid
+                and p2 in [x.node for x in repo.mq.applied]):
                 urev = p2
             uctx = repo[urev]