D12087: unamend: error out when running on merge commit
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Jan 25 05:17:49 UTC 2022
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
It's better to error out than to produce a bad commit. We do that same
in `hg uncommit`. I haven't looked into how much work it is to make
them work instead.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12087
AFFECTED FILES
hgext/uncommit.py
tests/test-unamend.t
CHANGE DETAILS
diff --git a/tests/test-unamend.t b/tests/test-unamend.t
--- a/tests/test-unamend.t
+++ b/tests/test-unamend.t
@@ -443,8 +443,5 @@
A left
$ hg amend
$ hg unamend
- $ hg st --rev 1 --rev .
- A right
- R left (known-bad-output !)
- $ hg st --rev 2 --rev .
- A left (missing-correct-output !)
+ abort: cannot unamend merge changeset
+ [10]
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -273,6 +273,8 @@
curctx = repo[b'.']
rewriteutil.precheck(repo, [curctx.rev()], b'unamend')
+ if len(curctx.parents()) > 1:
+ raise error.InputError(_(b"cannot unamend merge changeset"))
# identify the commit to which to unamend
markers = list(predecessormarkers(curctx))
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list