[PATCH 2 of 6 standalone-strip-long-version] strip: move checksubstate from mq to strip

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Thu Sep 26 16:57:47 CDT 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1380229963 -7200
#      Thu Sep 26 23:12:43 2013 +0200
# Node ID 6d2dc61ebc769bb80de7ef1b1b9b89f93c318069
# Parent  b3237c62404cfab9b9ad7733d2cf7f241294518e
strip: move checksubstate from mq to strip

One more step for issue3824

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -86,10 +86,12 @@ except KeyError:
     class dummyui(object):
         def debug(self, msg):
             pass
     stripext = extensions.load(dummyui(), 'strip', '')
 
+checksubstate = stripext.checksubstate
+
 # Patch names looks like unix-file names.
 # They must be joinable with queue directory and result in the patch path.
 normname = util.normpath
 
 class statusentry(object):
@@ -2905,27 +2907,10 @@ def save(ui, repo, **opts):
         del q.applied[:]
         q.applieddirty = True
         q.savedirty()
     return 0
 
-def checksubstate(repo, baserev=None):
-    '''return list of subrepos at a different revision than substate.
-    Abort if any subrepos have uncommitted changes.'''
-    inclsubs = []
-    wctx = repo[None]
-    if baserev:
-        bctx = repo[baserev]
-    else:
-        bctx = wctx.parents()[0]
-    for s in sorted(wctx.substate):
-        if wctx.sub(s).dirty(True):
-            raise util.Abort(
-                _("uncommitted changes in subrepository %s") % s)
-        elif s not in bctx.substate or bctx.sub(s).dirty():
-            inclsubs.append(s)
-    return inclsubs
-
 def checklocalchanges(repo, force=False, excsuffix=''):
     cmdutil.checkunfinished(repo)
     m, a, r, d = repo.status()[:4]
     if not force:
         if (m or a or r or d):
diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -1,5 +1,24 @@
-from mercurial import cmdutil
+from mercurial.i18n import _
+from mercurial import cmdutil, util
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 testedwith = 'internal'
+
+def checksubstate(repo, baserev=None):
+    '''return list of subrepos at a different revision than substate.
+    Abort if any subrepos have uncommitted changes.'''
+    inclsubs = []
+    wctx = repo[None]
+    if baserev:
+        bctx = repo[baserev]
+    else:
+        bctx = wctx.parents()[0]
+    for s in sorted(wctx.substate):
+        if wctx.sub(s).dirty(True):
+            raise util.Abort(
+                _("uncommitted changes in subrepository %s") % s)
+        elif s not in bctx.substate or bctx.sub(s).dirty():
+            inclsubs.append(s)
+    return inclsubs
+


More information about the Mercurial-devel mailing list