changeset 19823:6fb14d21fe9d

strip: move checksubstate from mq to strip One more step for issue3824
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 26 Sep 2013 23:12:43 +0200
parents a194a33f8cb2
children 237e40b2c1ff
files hgext/mq.py hgext/strip.py
diffstat 2 files changed, 22 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Thu Sep 26 23:10:11 2013 +0200
+++ b/hgext/mq.py	Thu Sep 26 23:12:43 2013 +0200
@@ -88,6 +88,8 @@
             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
@@ -2907,23 +2909,6 @@
         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]
--- a/hgext/strip.py	Thu Sep 26 23:10:11 2013 +0200
+++ b/hgext/strip.py	Thu Sep 26 23:12:43 2013 +0200
@@ -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
+