Patchwork D11222: fix: use obsolete.isenabled() to check for experimental.allowdivergence

login
register
mail settings
Submitter phabricator
Date July 28, 2021, 12:32 p.m.
Message ID <differential-rev-PHID-DREV-6swt4zw2nq4vudtyymzp-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49535/
State Superseded
Headers show

Comments

phabricator - July 28, 2021, 12:32 p.m.
av6 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that obsolete.isenabled() can also check if divergence is allowed, let's
  use it for consistency. Other experimental.evolution options are already
  checked via this function.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11222

AFFECTED FILES
  hgext/fix.py

CHANGE DETAILS




To: av6, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -147,6 +147,7 @@ 
     mdiff,
     merge,
     mergestate as mergestatemod,
+    obsolete,
     pycompat,
     registrar,
     rewriteutil,
@@ -451,10 +452,7 @@ 
     """Aborts if the revision shouldn't be replaced with a fixed one."""
     if ctx.obsolete():
         # It would be better to actually check if the revision has a successor.
-        allowdivergence = ui.configbool(
-            b'experimental', b'evolution.allowdivergence'
-        )
-        if not allowdivergence:
+        if not obsolete.isenabled(repo, obsolete.allowdivergenceopt):
             raise error.Abort(
                 b'fixing obsolete revision could cause divergence'
             )