diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py --- a/mercurial/rewriteutil.py +++ b/mercurial/rewriteutil.py @@ -49,7 +49,7 @@ return summary -def precheck(repo, revs, action=b'rewrite'): +def precheck(repo, revs, action=b'rewrite', successors=None): """check if revs can be rewritten action is used to control the error message. @@ -85,6 +85,10 @@ hint=hint, ) + # Adding a prune marker (A, ()) to obsstore can't be diverging + if action == b'prune' and not successors: + return + if not obsolete.isenabled(repo, obsolete.allowdivergenceopt): new_divergence = _find_new_divergence(repo, revs) if new_divergence: