# HG changeset patch # User Matt Mackall # Date 1160435618 18000 # Node ID 20087b4bc6f920c74467b0e1663c2cee9f980bd9 # Parent 72d1e521da7712f8523460d491f312d8853c9a6d merge: don't call hooks for revert - don't call hooks for revert - use extra variables to avoid swapping contexts diff -r 72d1e521da77 -r 20087b4bc6f9 mercurial/merge.py --- a/mercurial/merge.py Mon Oct 09 16:07:19 2006 -0500 +++ b/mercurial/merge.py Mon Oct 09 18:13:38 2006 -0500 @@ -425,20 +425,21 @@ ### apply phase if not branchmerge: - # we don't need to do any magic, just jump to the new rev - p1, p2 = p2, repo.changectx(nullid) + # just jump to the new rev + fp1, fp2, xp1, xp2 = p2.node(), nullid, str(p2), '' + else: + fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2) - xp1, xp2 = str(p1), str(p2) - if not p2: xp2 = '' - - repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) + if not partial: + repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) updated, merged, removed, unresolved = applyupdates(repo, action, xp1, xp2) # update dirstate if not partial: recordupdates(repo, action, branchmerge) - repo.dirstate.setparents(p1.node(), p2.node()) + repo.dirstate.setparents(fp1, fp2) + repo.hook('update', parent1=xp1, parent2=xp2, error=unresolved) if show_stats: stats = ((updated, _("updated")), @@ -461,6 +462,5 @@ repo.ui.status(_("There are unresolved merges with" " locally modified files.\n")) - repo.hook('update', parent1=xp1, parent2=xp2, error=unresolved) return unresolved