comparison mercurial/commands.py @ 17045:52ea9ce5b641 stable

graft: don't drop the second parent on unsuccessful merge (issue3498) This replicates the strategy of rebase, which postpones setparents and duplicatecopies after checking the merge stats. Without the second parent, resolve cannot redo merge.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 16 Jun 2012 17:05:55 +0900
parents 6e578e77cbe6
children fba17a64fa49 b558c9fa39c1
comparison
equal deleted inserted replaced
17041:86a3bb9c5f5c 17045:52ea9ce5b641
2694 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) 2694 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
2695 stats = mergemod.update(repo, ctx.node(), True, True, False, 2695 stats = mergemod.update(repo, ctx.node(), True, True, False,
2696 ctx.p1().node()) 2696 ctx.p1().node())
2697 finally: 2697 finally:
2698 repo.ui.setconfig('ui', 'forcemerge', '') 2698 repo.ui.setconfig('ui', 'forcemerge', '')
2699 # drop the second merge parent
2700 repo.setparents(current.node(), nullid)
2701 repo.dirstate.write()
2702 # fix up dirstate for copies and renames
2703 cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
2704 # report any conflicts 2699 # report any conflicts
2705 if stats and stats[3] > 0: 2700 if stats and stats[3] > 0:
2706 # write out state for --continue 2701 # write out state for --continue
2707 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] 2702 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
2708 repo.opener.write('graftstate', ''.join(nodelines)) 2703 repo.opener.write('graftstate', ''.join(nodelines))
2709 raise util.Abort( 2704 raise util.Abort(
2710 _("unresolved conflicts, can't continue"), 2705 _("unresolved conflicts, can't continue"),
2711 hint=_('use hg resolve and hg graft --continue')) 2706 hint=_('use hg resolve and hg graft --continue'))
2712 else: 2707 else:
2713 cont = False 2708 cont = False
2709
2710 # drop the second merge parent
2711 repo.setparents(current.node(), nullid)
2712 repo.dirstate.write()
2713 # fix up dirstate for copies and renames
2714 cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
2714 2715
2715 # commit 2716 # commit
2716 source = ctx.extra().get('source') 2717 source = ctx.extra().get('source')
2717 if not source: 2718 if not source:
2718 source = ctx.hex() 2719 source = ctx.hex()