comparison hgext/mq.py @ 19814:4495c6a272e0

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.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 25 Sep 2013 12:43:14 +0200
parents 76796fe65bad
children 378567bf9f74
comparison
equal deleted inserted replaced
19813:76796fe65bad 19814:4495c6a272e0
962 if refresh: 962 if refresh:
963 excsuffix = ', refresh first' 963 excsuffix = ', refresh first'
964 # plain versions for i18n tool to detect them 964 # plain versions for i18n tool to detect them
965 _("local changes found, refresh first") 965 _("local changes found, refresh first")
966 _("local changed subrepos found, refresh first") 966 _("local changed subrepos found, refresh first")
967 cmdutil.checkunfinished(repo) 967 return checklocalchanges(repo, force, excsuffix)
968 m, a, r, d = repo.status()[:4]
969 if not force:
970 if (m or a or r or d):
971 _("local changes found") # i18n tool detection
972 raise util.Abort(_("local changes found" + excsuffix))
973 if checksubstate(repo):
974 _("local changed subrepos found") # i18n tool detection
975 raise util.Abort(_("local changed subrepos found" + excsuffix))
976 return m, a, r, d
977 968
978 _reserved = ('series', 'status', 'guards', '.', '..') 969 _reserved = ('series', 'status', 'guards', '.', '..')
979 def checkreservedname(self, name): 970 def checkreservedname(self, name):
980 if name in self._reserved: 971 if name in self._reserved:
981 raise util.Abort(_('"%s" cannot be used as the name of a patch') 972 raise util.Abort(_('"%s" cannot be used as the name of a patch')
2929 _("uncommitted changes in subrepository %s") % s) 2920 _("uncommitted changes in subrepository %s") % s)
2930 elif s not in bctx.substate or bctx.sub(s).dirty(): 2921 elif s not in bctx.substate or bctx.sub(s).dirty():
2931 inclsubs.append(s) 2922 inclsubs.append(s)
2932 return inclsubs 2923 return inclsubs
2933 2924
2925 def checklocalchanges(repo, force=False, excsuffix=''):
2926 cmdutil.checkunfinished(repo)
2927 m, a, r, d = repo.status()[:4]
2928 if not force:
2929 if (m or a or r or d):
2930 _("local changes found") # i18n tool detection
2931 raise util.Abort(_("local changes found" + excsuffix))
2932 if checksubstate(repo):
2933 _("local changed subrepos found") # i18n tool detection
2934 raise util.Abort(_("local changed subrepos found" + excsuffix))
2935 return m, a, r, d
2936
2934 2937
2935 @command("strip", 2938 @command("strip",
2936 [ 2939 [
2937 ('r', 'rev', [], _('strip specified revision (optional, ' 2940 ('r', 'rev', [], _('strip specified revision (optional, '
2938 'can specify revisions without this ' 2941 'can specify revisions without this '