changeset 47057:8ad2f43fe37b

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
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 11 Feb 2021 15:02:57 -0800
parents 7001f92e0ee9
children da4e6d7a8fdd
files mercurial/rewriteutil.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/rewriteutil.py	Tue Apr 27 11:02:41 2021 -0700
+++ b/mercurial/rewriteutil.py	Thu Feb 11 15:02:57 2021 -0800
@@ -21,6 +21,7 @@
     obsutil,
     revset,
     scmutil,
+    util,
 )
 
 
@@ -38,6 +39,10 @@
         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)