diff hgext/uncommit.py @ 48983:533820f5b997

merge: with stable
author Augie Fackler <augie@google.com>
date Fri, 25 Mar 2022 11:33:12 -0400
parents f254fc73d956 9120c0cd935c
children c166b212bdee
line wrap: on
line diff
--- 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: