diff mercurial/obsolete.py @ 47020:ba6881c6a178

rewriteutil: check for divergence This code is adapted from the code in the evolve extension. It seems to be equivalent as far as the evolve extension's test suite can tell (the only impact when making their `precheck()` delegate to our version is that error messages are less detailed). I had to change the error message to work with "change branch of" being inserted as the action. Differential Revision: https://phab.mercurial-scm.org/D10518
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 23 Feb 2021 10:28:42 -0800
parents d55b71393907
children b1e1559f5a45
line wrap: on
line diff
--- a/mercurial/obsolete.py	Wed Apr 28 08:48:10 2021 -0700
+++ b/mercurial/obsolete.py	Tue Feb 23 10:28:42 2021 -0800
@@ -106,6 +106,7 @@
 # Options for obsolescence
 createmarkersopt = b'createmarkers'
 allowunstableopt = b'allowunstable'
+allowdivergenceopt = b'allowdivergence'
 exchangeopt = b'exchange'
 
 
@@ -144,10 +145,13 @@
 
     createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
     unstablevalue = _getoptionvalue(repo, allowunstableopt)
+    divergencevalue = _getoptionvalue(repo, allowdivergenceopt)
     exchangevalue = _getoptionvalue(repo, exchangeopt)
 
     # createmarkers must be enabled if other options are enabled
-    if (unstablevalue or exchangevalue) and not createmarkersvalue:
+    if (
+        unstablevalue or divergencevalue or exchangevalue
+    ) and not createmarkersvalue:
         raise error.Abort(
             _(
                 b"'createmarkers' obsolete option must be enabled "
@@ -158,6 +162,7 @@
     return {
         createmarkersopt: createmarkersvalue,
         allowunstableopt: unstablevalue,
+        allowdivergenceopt: divergencevalue,
         exchangeopt: exchangevalue,
     }