diff hgext/histedit.py @ 17130:0a48f3d54543

histedit: don't crash if the result of fixing up a fold is empty
author Augie Fackler <raf@durin42.com>
date Fri, 06 Jul 2012 11:39:02 -0500
parents ead4eb5b03c9
children 4fb2d3d16743
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Jul 06 11:06:57 2012 -0500
+++ b/hgext/histedit.py	Fri Jul 06 11:39:02 2012 -0500
@@ -307,7 +307,11 @@
             new = repo.commit(text=message, user=oldctx.user(),
                               date=oldctx.date(), extra=oldctx.extra())
 
-        if action in ('f', 'fold'):
+        # If we're resuming a fold and we have new changes, mark the
+        # replacements and finish the fold. If not, it's more like a
+        # drop of the changesets that disappeared, and we can skip
+        # this step.
+        if action in ('f', 'fold') and (new or newchildren):
             if new:
                 tmpnodes.append(new)
             else: