hgext/uncommit.py
changeset 48983 533820f5b997
parent 48913 f254fc73d956
parent 48979 9120c0cd935c
child 49960 c166b212bdee
--- a/hgext/uncommit.py	Thu Mar 17 11:19:06 2022 -0700
+++ b/hgext/uncommit.py	Fri Mar 25 11:33:12 2022 -0400
@@ -273,6 +273,15 @@
         if len(curctx.parents()) > 1:
             raise error.InputError(_(b"cannot unamend merge changeset"))
 
+        expected_keys = (b'amend_source', b'unamend_source')
+        if not any(key in curctx.extra() for key in expected_keys):
+            raise error.InputError(
+                _(
+                    b"working copy parent was not created by 'hg amend' or "
+                    b"'hg unamend'"
+                )
+            )
+
         # identify the commit to which to unamend
         markers = list(predecessormarkers(curctx))
         if len(markers) != 1: