diff -r 9dfbea54b680 -r 533820f5b997 hgext/uncommit.py --- 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: