diff mercurial/rewriteutil.py @ 47787:48da5c325750 stable

rewriteutil: fix crash when a rewritten message references f{6,64} Without this, the rewriteutil logic thinks it's found a reference to the wdir pseudo-revision, and then tries to look it up and rewrite it. Stop it from doing that. Amusingly, I had trouble working with this changeset when I didn't describe the defect above using a regular expression, because it would trigger the bug in my installed version of hg. Differential Revision: https://phab.mercurial-scm.org/D11232
author Augie Fackler <augie@google.com>
date Thu, 29 Jul 2021 16:23:45 -0400
parents debc29900b97
children 6000f5b25c9b d4752aeb20f1
line wrap: on
line diff
--- a/mercurial/rewriteutil.py	Thu Jul 29 16:18:35 2021 -0400
+++ b/mercurial/rewriteutil.py	Thu Jul 29 16:23:45 2021 -0400
@@ -207,7 +207,12 @@
     hashes = re.findall(NODE_RE, commitmsg)
     unfi = repo.unfiltered()
     for h in hashes:
-        fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
+        try:
+            fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
+        except error.WdirUnsupported:
+            # Someone has an fffff... in a commit message we're
+            # rewriting. Don't try rewriting that.
+            continue
         if fullnode is None:
             continue
         ctx = unfi[fullnode]