mercurial/rewriteutil.py
changeset 35242 27d5c2d2db2b
child 35243 490df753894d
equal deleted inserted replaced
35241:2a99c5bfea47 35242:27d5c2d2db2b
       
     1 # rewriteutil.py - utility functions for rewriting changesets
       
     2 #
       
     3 # Copyright 2017 Octobus <contact@octobus.net>
       
     4 #
       
     5 # This software may be used and distributed according to the terms of the
       
     6 # GNU General Public License version 2 or any later version.
       
     7 
       
     8 from __future__ import absolute_import
       
     9 
       
    10 from . import (
       
    11     obsolete,
       
    12     revset,
       
    13 )
       
    14 
       
    15 def disallowednewunstable(repo, revs):
       
    16     """Checks whether editing the revs will create new unstable changesets and
       
    17     are we allowed to create them.
       
    18 
       
    19     To allow new unstable changesets, set the config:
       
    20         `experimental.evolution.allowunstable=True`
       
    21     """
       
    22     allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
       
    23     if allowunstable:
       
    24         return revset.baseset()
       
    25     return repo.revs("(%ld::) - %ld", revs, revs)