mercurial/rewriteutil.py
changeset 45711 3d68b47e461b
parent 45427 78861610ded8
child 45853 b4694ef45db5
--- a/mercurial/rewriteutil.py	Fri Oct 09 10:20:53 2020 +0200
+++ b/mercurial/rewriteutil.py	Thu Oct 08 23:33:04 2020 -0400
@@ -111,8 +111,18 @@
         # We can't make any assumptions about how to update the hash if the
         # cset in question was split or diverged.
         if len(successors) == 1 and len(successors[0]) == 1:
-            newhash = node.hex(successors[0][0])
-            commitmsg = commitmsg.replace(h, newhash[: len(h)])
+            successor = successors[0][0]
+            if successor is not None:
+                newhash = node.hex(successor)
+                commitmsg = commitmsg.replace(h, newhash[: len(h)])
+            else:
+                repo.ui.note(
+                    _(
+                        b'The stale commit message reference to %s could '
+                        b'not be updated\n(The referenced commit was dropped)\n'
+                    )
+                    % h
+                )
         else:
             repo.ui.note(
                 _(