--- a/hgext/histedit.py Thu Aug 01 17:54:12 2013 -0500
+++ b/hgext/histedit.py Thu Aug 01 19:55:02 2013 -0500
@@ -506,7 +506,14 @@
(parentctxnode, rules, keep, topmost, replacements) = readstate(repo)
mapping, tmpnodes, leafs, _ntm = processreplacement(repo, replacements)
ui.debug('restore wc to old parent %s\n' % node.short(topmost))
- hg.clean(repo, topmost)
+ # check whether we should update away
+ parentnodes = [c.node() for c in repo[None].parents()]
+ for n in leafs | set([parentctxnode]):
+ if n in parentnodes:
+ hg.clean(repo, topmost)
+ break
+ else:
+ pass
cleanupnode(ui, repo, 'created', tmpnodes)
cleanupnode(ui, repo, 'temp', leafs)
os.unlink(os.path.join(repo.path, 'histedit-state'))