Skip to content
Snippets Groups Projects
Commit 27d5c2d2 authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

rewriteutil: add utility function to check if we can create new unstable cset

This patch adds a new file which will contain utility functions related to
rewritting changesets. It also adds a utility function to check if the
rewritting operation creates new unstable changesets and are we allowed to
create them.

This rewriteutil.py introduced in this patch and the utility functions added in
the upcoming patches exists in the evolve extension are being ported from there.

Differential Revision: https://phab.mercurial-scm.org/D1502
parent 2a99c5bf
No related branches found
No related tags found
No related merge requests found
# rewriteutil.py - utility functions for rewriting changesets
#
# Copyright 2017 Octobus <contact@octobus.net>
#
# 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment