diff hgext/rebase.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 d9601243b73c
children de54d11040e7
line wrap: on
line diff
--- a/hgext/rebase.py	Wed Apr 28 08:48:10 2021 -0700
+++ b/hgext/rebase.py	Tue Feb 23 10:28:42 2021 -0800
@@ -446,8 +446,15 @@
             rebaseset = set(destmap.keys())
             rebaseset -= set(self.obsolete_with_successor_in_destination)
             rebaseset -= self.obsolete_with_successor_in_rebase_set
+            # We have our own divergence-checking in the rebase extension
+            overrides = {}
+            if obsolete.isenabled(self.repo, obsolete.createmarkersopt):
+                overrides = {
+                    (b'experimental', b'evolution.allowdivergence'): b'true'
+                }
             try:
-                rewriteutil.precheck(self.repo, rebaseset, action=b'rebase')
+                with self.ui.configoverride(overrides):
+                    rewriteutil.precheck(self.repo, rebaseset, action=b'rebase')
             except error.Abort as e:
                 if e.hint is None:
                     e.hint = _(b'use --keep to keep original changesets')