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

av6 (Anton Shestakov) phabricator at mercurial-scm.org
Wed Jul 28 12:32:31 UTC 2021


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

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'
             )



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


More information about the Mercurial-devel mailing list