comparison 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
comparison
equal deleted inserted replaced
48977:bd752712ccaf 48979:9120c0cd935c
37 o 0:18d04c59bb5d Added a 37 o 0:18d04c59bb5d Added a
38 38
39 Trying to unamend when there was no amend done 39 Trying to unamend when there was no amend done
40 40
41 $ hg unamend 41 $ hg unamend
42 abort: working copy parent was not created by 'hg amend' or 'hg unamend'
43 [10]
44 $ echo "bar" >> h
45
46 Trying to unamend when the obsmarker is missing
47
48 $ hg amend
49 $ hg debugobsolete --delete 0
50 deleted 1 obsolescence markers
51 $ hg unamend
42 abort: changeset must have one predecessor, found 0 predecessors 52 abort: changeset must have one predecessor, found 0 predecessors
43 [10] 53 [10]
54 $ hg strip tip --config extensions.strip=
55 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
56 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c9fa1a715c1b-06e5c233-backup.hg
57 $ hg up tip
58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 59
45 Unamend on clean wdir and tip 60 Unamend on clean wdir and tip
46 61
47 $ echo "bar" >> h 62 $ echo "bar" >> h
48 $ hg amend 63 $ hg amend