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

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 26, 2013, 9:57 p.m.
Message ID <a4f5d3d0086b7481ad2d.1380232668@vulgaris>
Download mbox | patch
Permalink /patch/2650/
State Accepted
Commit 237e40b2c1ffb70f372b5bd3288d926d823a1e8f
Headers show

Comments

Pierre-Yves David - Sept. 26, 2013, 9:57 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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
+