mq: remove dependency on strip's checklocalchanges()
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 17 Jun 2019 10:38:50 -0700
changeset 42489 cf445a212b9c
parent 42488 c0b51449bf6b
child 42490 3a1988e915f9
mq: remove dependency on strip's checklocalchanges() Some of the functionality in strip.checklocalchanges() was only used by mq, so let's move it to mq so we can clean up strip. Differential Revision: https://phab.mercurial-scm.org/D6533
hgext/mq.py
--- a/hgext/mq.py	Thu May 02 23:39:33 2019 -0700
+++ b/hgext/mq.py	Mon Jun 17 10:38:50 2019 -0700
@@ -145,8 +145,6 @@
 
 strip = stripext.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.
@@ -1149,7 +1147,20 @@
             # plain versions for i18n tool to detect them
             _("local changes found, qrefresh first")
             _("local changed subrepos found, qrefresh first")
-        return checklocalchanges(repo, force, excsuffix)
+
+        cmdutil.checkunfinished(repo)
+        s = repo.status()
+        if not force:
+            if len(repo[None].parents()) > 1:
+                _("outstanding uncommitted merge") #i18 tool detection
+                raise error.Abort(_("outstanding uncommitted merge"+ excsuffix))
+            if s.modified or s.added or s.removed or s.deleted:
+                _("local changes found") # i18n tool detection
+                raise error.Abort(_("local changes found" + excsuffix))
+            if checksubstate(repo):
+                _("local changed subrepos found") # i18n tool detection
+                raise error.Abort(_("local changed subrepos found" + excsuffix))
+        return s
 
     _reserved = ('series', 'status', 'guards', '.', '..')
     def checkreservedname(self, name):