[Updated] D12087: unamend: error out when running on merge commit

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Jan 25 09:53:51 UTC 2022


Closed by commit rHG4f01821fa0ec: unamend: error out when running on merge commit (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12087?vs=31901&id=31978

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12087/new/

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, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220125/9d4df162/attachment-0002.html>


More information about the Mercurial-patches mailing list