diff mercurial/rewriteutil.py @ 49067:bde2e4ef968a

merge: stable into default
author Rapha?l Gom?s <rgomes@octobus.net>
date Tue, 29 Mar 2022 14:27:45 +0200
parents 6000f5b25c9b d4752aeb20f1
children ea98850a136e
line wrap: on
line diff
--- a/mercurial/rewriteutil.py	Thu Mar 24 21:26:45 2022 -0500
+++ b/mercurial/rewriteutil.py	Tue Mar 29 14:27:45 2022 +0200
@@ -48,10 +48,13 @@
     return summary
 
 
-def precheck(repo, revs, action=b'rewrite'):
+def precheck(repo, revs, action=b'rewrite', check_divergence=True):
     """check if revs can be rewritten
     action is used to control the error message.
 
+    check_divergence allows skipping the divergence checks in cases like adding
+    a prune marker (A, ()) to obsstore (which can't be diverging).
+
     Make sure this function is called after taking the lock.
     """
     if nullrev in revs:
@@ -84,6 +87,9 @@
             hint=hint,
         )
 
+    if not check_divergence:
+        return
+
     if not obsolete.isenabled(repo, obsolete.allowdivergenceopt):
         new_divergence = _find_new_divergence(repo, revs)
         if new_divergence: