Mercurial > hg
diff tests/test-unamend.t @ 48979:9120c0cd935c stable
unamend: abort if commit was not created by `hg [un]amend`
`hg unamend` can currently undo any kind of rewrite, as long as it has
an obsmarker. However, that has quite unexpected results if you run it
after e.g. `hg rebase` (expecting it to behave like a generic `hg
undo` command), because it updates to the predecessor and leaves the
old changes in the working copy. I think it's better to allow `hg
unamend` only after `hg amend` (and after `hg unamend` because that's
documented as being supported).
Differential Revision: https://phab.mercurial-scm.org/D12390
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 21 Mar 2022 14:21:10 -0700 |
parents | 4f01821fa0ec |
children | 2f2682f40ea0 |
line wrap: on
line diff
--- a/tests/test-unamend.t Thu Mar 17 14:58:46 2022 +0100 +++ b/tests/test-unamend.t Mon Mar 21 14:21:10 2022 -0700 @@ -39,8 +39,23 @@ Trying to unamend when there was no amend done $ hg unamend + abort: working copy parent was not created by 'hg amend' or 'hg unamend' + [10] + $ echo "bar" >> h + +Trying to unamend when the obsmarker is missing + + $ hg amend + $ hg debugobsolete --delete 0 + deleted 1 obsolescence markers + $ hg unamend abort: changeset must have one predecessor, found 0 predecessors [10] + $ hg strip tip --config extensions.strip= + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c9fa1a715c1b-06e5c233-backup.hg + $ hg up tip + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Unamend on clean wdir and tip