[PATCH 3 of 6 standalone-strip-long-version] strip: move checklocalchanges from mq to strip

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1380231172 -7200
#      Thu Sep 26 23:32:52 2013 +0200
# Node ID a4f5d3d0086b7481ad2de9dc785f4455b4298265
# Parent  6d2dc61ebc769bb80de7ef1b1b9b89f93c318069
strip: move checklocalchanges 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
@@ -87,10 +87,12 @@ except KeyError:
         def debug(self, msg):
             pass
     stripext = extensions.load(dummyui(), 'strip', '')
 
 checksubstate = stripext.checksubstate
+checklocalchanges = stripext.checklocalchanges
+
 
 # Patch names looks like unix-file names.
 # They must be joinable with queue directory and result in the patch path.
 normname = util.normpath
 
@@ -2907,22 +2909,10 @@ def save(ui, repo, **opts):
         del q.applied[:]
         q.applieddirty = True
         q.savedirty()
     return 0
 
-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):
-            _("local changes found") # i18n tool detection
-            raise util.Abort(_("local changes found" + excsuffix))
-        if checksubstate(repo):
-            _("local changed subrepos found") # i18n tool detection
-            raise util.Abort(_("local changed subrepos found" + excsuffix))
-    return m, a, r, d
-
 def strip(ui, repo, revs, update=True, backup="all", force=None):
     wlock = lock = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -20,5 +20,17 @@ def checksubstate(repo, baserev=None):
                 _("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):
+            _("local changes found") # i18n tool detection
+            raise util.Abort(_("local changes found" + excsuffix))
+        if checksubstate(repo):
+            _("local changed subrepos found") # i18n tool detection
+            raise util.Abort(_("local changed subrepos found" + excsuffix))
+    return m, a, r, d
+


More information about the Mercurial-devel mailing list