Patchwork D10515: rewriteutil: add devel warning if precheck is called with contexts

login
register
mail settings
Submitter phabricator
Date April 28, 2021, 3:08 p.m.
Message ID <differential-rev-PHID-DREV-ehg4btutxx6wmcvrhmoi-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48833/
State Superseded
Headers show

Comments

phabricator - April 28, 2021, 3:08 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
pulkit accepted this revision.
This revision is now accepted and ready to land.

REVISION SUMMARY
  I'm trying to upstream parts from the evolve extension. This check
  exists there.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10515

AFFECTED FILES
  mercurial/rewriteutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py
--- a/mercurial/rewriteutil.py
+++ b/mercurial/rewriteutil.py
@@ -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)