diff hgext/absorb.py @ 42293:b3fc78c028ef

absorb: be more specific when erroring out on merge commit When you have a merge commit checked out and run `hg absorb`, it would tell you abort: no mutable changeset to change That makes it sound like the problem is public commits when isn't really. Let's be more specific in this case. There was already a test case that test this, so that now prints the new message. I added a new test case that shows the old message (when a public commit is checked out). Differential Revision: https://phab.mercurial-scm.org/D6354
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 08 May 2019 21:25:23 -0700
parents 537a8aeb9977
children 86f17fc31aa8
line wrap: on
line diff
--- a/hgext/absorb.py	Wed May 08 18:11:33 2019 -0400
+++ b/hgext/absorb.py	Wed May 08 21:25:23 2019 -0700
@@ -914,7 +914,10 @@
     """
     if stack is None:
         limit = ui.configint('absorb', 'max-stack-size')
-        stack = getdraftstack(repo['.'], limit)
+        headctx = repo['.']
+        if len(headctx.parents()) > 1:
+            raise error.Abort(_('cannot absorb into a merge'))
+        stack = getdraftstack(headctx, limit)
         if limit and len(stack) >= limit:
             ui.warn(_('absorb: only the recent %d changesets will '
                       'be analysed\n')