diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1417,6 +1417,11 @@ def verifyactions(actions, state, ctxs): expected = set(c.node() for c in ctxs) seen = set() prev = None + + if actions and actions[0].verb in ['roll', 'fold']: + raise error.ParseError(_('first changeset cannot use verb "%s"') % + actions[0].verb) + for action in actions: action.verify(prev, expected, seen) prev = action diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t +++ b/tests/test-histedit-edit.t @@ -460,7 +460,7 @@ Attempting to fold a change into a publi > EOF $ HGEDITOR="sh ../edit.sh" hg histedit 2 warning: histedit rules saved to: .hg/histedit-last-edit.txt - hg: parse error: cannot fold into public change 18aa70c8ad22 + hg: parse error: first changeset cannot use verb "fold" [255] $ cat .hg/histedit-last-edit.txt fold 0012be4a27ea 2 extend a diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t --- a/tests/test-histedit-fold.t +++ b/tests/test-histedit-fold.t @@ -541,3 +541,36 @@ Editor should have run only once END $ cd .. + +Test rolling into a commit with multiple children (issue5498) + + $ hg init roll + $ cd roll + $ echo a > a + $ hg commit -qAm aa + $ echo b > b + $ hg commit -qAm bb + $ hg up -q ".^" + $ echo c > c + $ hg commit -qAm cc + $ hg log -G -T '{node|short} {desc}' + @ 5db65b93a12b cc + | + | o 301d76bdc3ae bb + |/ + o 8f0162e483d0 aa + + + $ hg histedit . --commands - << EOF + > r 5db65b93a12b + > EOF + hg: parse error: first changeset cannot use verb "roll" + [255] + $ hg log -G -T '{node|short} {desc}' + @ 5db65b93a12b cc + | + | o 301d76bdc3ae bb + |/ + o 8f0162e483d0 aa + +