##// END OF EJS Templates
unamend: abort if commit was not created by `hg [un]amend`...
Martin von Zweigbergk -
r49836:9120c0cd stable
parent child Browse files
Show More
@@ -276,6 +276,15 b' def unamend(ui, repo, **opts):'
276 if len(curctx.parents()) > 1:
276 if len(curctx.parents()) > 1:
277 raise error.InputError(_(b"cannot unamend merge changeset"))
277 raise error.InputError(_(b"cannot unamend merge changeset"))
278
278
279 expected_keys = (b'amend_source', b'unamend_source')
280 if not any(key in curctx.extra() for key in expected_keys):
281 raise error.InputError(
282 _(
283 b"working copy parent was not created by 'hg amend' or "
284 b"'hg unamend'"
285 )
286 )
287
279 # identify the commit to which to unamend
288 # identify the commit to which to unamend
280 markers = list(predecessormarkers(curctx))
289 markers = list(predecessormarkers(curctx))
281 if len(markers) != 1:
290 if len(markers) != 1:
@@ -39,8 +39,23 b' Repo Setup'
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
General Comments 0
You need to be logged in to leave comments. Login now