--- a/hgext3rd/evolve/__init__.py Sat Jul 22 23:40:28 2017 +0200
+++ b/hgext3rd/evolve/__init__.py Sun Jul 23 04:46:33 2017 +0200
@@ -2325,7 +2325,7 @@
if not precs:
raise error.Abort('nothing to prune')
- if _disallowednewunstable(repo, revs):
+ if rewriteutil.disallowednewunstable(repo, revs):
raise error.Abort(_("cannot prune in the middle of a stack"),
hint=_("new unstable changesets are not allowed"))
@@ -2850,7 +2850,7 @@
if repo.revs("%ld and public()", revs):
raise error.Abort(_('cannot edit commit information for public '
'revisions'))
- newunstable = _disallowednewunstable(repo, revs)
+ newunstable = rewriteutil.disallowednewunstable(repo, revs)
if newunstable:
msg = _('cannot edit commit information in the middle'
' of a stack')
@@ -2919,18 +2919,12 @@
raise error.Abort(_("cannot fold non-linear revisions "
"(multiple heads given)"))
head = repo[heads.first()]
- if _disallowednewunstable(repo, revs):
+ if rewriteutil.disallowednewunstable(repo, revs):
msg = _("cannot fold chain not ending with a head or with branching")
hint = _("new unstable changesets are not allowed")
raise error.Abort(msg, hint=hint)
return root, head
-def _disallowednewunstable(repo, revs):
- allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
- if allowunstable:
- return revset.baseset()
- return repo.revs("(%ld::) - %ld", revs, revs)
-
@eh.wrapcommand('graft')
def graftwrapper(orig, ui, repo, *revs, **kwargs):
kwargs = dict(kwargs)
--- a/hgext3rd/evolve/rewriteutil.py Sat Jul 22 23:40:28 2017 +0200
+++ b/hgext3rd/evolve/rewriteutil.py Sun Jul 23 04:46:33 2017 +0200
@@ -11,6 +11,11 @@
# happy one piece of it (and hopefully, able to reuse it in other core
# commands).
+from mercurial import (
+ obsolete,
+ revset,
+)
+
from . import (
compat,
)
@@ -25,3 +30,13 @@
if bmchanges:
compat.bookmarkapplychanges(repo, tr, bmchanges)
return updatebookmarks
+
+def disallowednewunstable(repo, revs):
+ """Check that editing <revs> will not create disallowed unstable
+
+ (unstable creation is controled by some special config).
+ """
+ allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
+ if allowunstable:
+ return revset.baseset()
+ return repo.revs("(%ld::) - %ld", revs, revs)