# HG changeset patch # User Martin von Zweigbergk # Date 2021-02-11 23:02:57 # Node ID 8ad2f43fe37bdf1cc14337d63d0948183dffd824 # Parent 7001f92e0ee95f17fea0bb0d0f1cd1d6c3c9d11e rewriteutil: add devel warning if precheck is called with contexts I'm trying to upstream parts from the evolve extension. This check exists there. Differential Revision: https://phab.mercurial-scm.org/D10515 diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py --- a/mercurial/rewriteutil.py +++ b/mercurial/rewriteutil.py @@ -21,6 +21,7 @@ from . import ( obsutil, revset, scmutil, + util, ) @@ -38,6 +39,10 @@ def precheck(repo, revs, action=b'rewrit hint = _(b"no changeset checked out") raise error.InputError(msg, hint=hint) + if any(util.safehasattr(r, 'rev') for r in revs): + repo.ui.develwarn(b"rewriteutil.precheck called with ctx not revs") + revs = (r.rev() for r in revs) + if len(repo[None].parents()) > 1: raise error.StateError(_(b"cannot %s while merging") % action)