comparison hgext/histedit.py @ 19519:c2a479a058d0 stable

histedit: don't clobber working copy on --abort if not on histedit cset Similar to issue4009, 2.7 will force people to abort histedits before doing interesting things. Without this fix, people with histedit sessions they wandered away from before upgrading to 2.7 could clobber their working copy for no reason.
author Matt Mackall <mpm@selenic.com>
date Thu, 01 Aug 2013 19:55:02 -0500
parents 607191a45f8c
children 11de0651d3b6
comparison
equal deleted inserted replaced
19518:12843143663d 19519:c2a479a058d0
504 replacements.extend(repl) 504 replacements.extend(repl)
505 elif goal == 'abort': 505 elif goal == 'abort':
506 (parentctxnode, rules, keep, topmost, replacements) = readstate(repo) 506 (parentctxnode, rules, keep, topmost, replacements) = readstate(repo)
507 mapping, tmpnodes, leafs, _ntm = processreplacement(repo, replacements) 507 mapping, tmpnodes, leafs, _ntm = processreplacement(repo, replacements)
508 ui.debug('restore wc to old parent %s\n' % node.short(topmost)) 508 ui.debug('restore wc to old parent %s\n' % node.short(topmost))
509 hg.clean(repo, topmost) 509 # check whether we should update away
510 parentnodes = [c.node() for c in repo[None].parents()]
511 for n in leafs | set([parentctxnode]):
512 if n in parentnodes:
513 hg.clean(repo, topmost)
514 break
515 else:
516 pass
510 cleanupnode(ui, repo, 'created', tmpnodes) 517 cleanupnode(ui, repo, 'created', tmpnodes)
511 cleanupnode(ui, repo, 'temp', leafs) 518 cleanupnode(ui, repo, 'temp', leafs)
512 os.unlink(os.path.join(repo.path, 'histedit-state')) 519 os.unlink(os.path.join(repo.path, 'histedit-state'))
513 return 520 return
514 else: 521 else: