mq: extract checklocalchanges from `mq.queue`
The core part of `checklocalchanges` is now mq independent. We can extract it in
a standalone function to help the extraction of `strip` as discussed in issue3824.
A `checklocalchanges` function stay in `mq.queue` with the part related to
"refresh first" messages.
--- a/hgext/mq.py Wed Sep 25 11:24:43 2013 +0200
+++ b/hgext/mq.py Wed Sep 25 12:43:14 2013 +0200
@@ -964,16 +964,7 @@
# plain versions for i18n tool to detect them
_("local changes found, refresh first")
_("local changed subrepos found, refresh first")
- 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
+ return checklocalchanges(repo, force, excsuffix)
_reserved = ('series', 'status', 'guards', '.', '..')
def checkreservedname(self, name):
@@ -2931,6 +2922,18 @@
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
+
@command("strip",
[