diff -r 2a99c5bfea47 -r 27d5c2d2db2b mercurial/rewriteutil.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mercurial/rewriteutil.py Fri Nov 24 03:40:33 2017 +0530 @@ -0,0 +1,25 @@ +# rewriteutil.py - utility functions for rewriting changesets +# +# Copyright 2017 Octobus +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +from __future__ import absolute_import + +from . import ( + obsolete, + revset, +) + +def disallowednewunstable(repo, revs): + """Checks whether editing the revs will create new unstable changesets and + are we allowed to create them. + + To allow new unstable changesets, set the config: + `experimental.evolution.allowunstable=True` + """ + allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) + if allowunstable: + return revset.baseset() + return repo.revs("(%ld::) - %ld", revs, revs)