# HG changeset patch # User Augie Fackler # Date 1433532033 14400 # Node ID 43906060a3f4f880c06f91d723fac20f959c2bbb # Parent f0acc3e0bd322f15c11dc6cd6c5de30879fd7dbc histedit: abort rather than edit a public changeset (issue4704) This is suboptimal as the user still has to explicitly cancel the histedit afterwards, but it prevents the immediate problem. histedit should probably implicitly do 'hg histedit --abort' if a util.Abort is raised internally. diff -r f0acc3e0bd32 -r 43906060a3f4 hgext/histedit.py --- a/hgext/histedit.py Fri Jun 05 15:06:58 2015 -0400 +++ b/hgext/histedit.py Fri Jun 05 15:20:33 2015 -0400 @@ -433,6 +433,10 @@ ctxs = list(repo.set('%d::%d', first, last)) if not ctxs: return None + for c in ctxs: + if not c.mutable(): + raise util.Abort( + _("cannot fold into public change %s") % node.short(c.node())) base = first.parents()[0] # commit a new version of the old changeset, including the update diff -r f0acc3e0bd32 -r 43906060a3f4 tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t Fri Jun 05 15:06:58 2015 -0400 +++ b/tests/test-histedit-edit.t Fri Jun 05 15:20:33 2015 -0400 @@ -456,12 +456,12 @@ > cat "\$1" | sed s/pick/fold/ > tmp > mv tmp "\$1" > EOF -(BROKEN) $ HGEDITOR="sh ../edit.sh" hg histedit 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved reverting a 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/r0/.hg/strip-backup/18aa70c8ad22-3aea8ae3-backup.hg (glob) -(BROKEN) + abort: cannot fold into public change 18aa70c8ad22 + [255] +TODO: this abort shouldn't be required, but it is for now to leave the repo in +a clean state. + $ hg histedit --abort