changeset 3296:20087b4bc6f9

merge: don't call hooks for revert - don't call hooks for revert - use extra variables to avoid swapping contexts
author Matt Mackall <mpm@selenic.com>
date Mon, 09 Oct 2006 18:13:38 -0500
parents 72d1e521da77
children 69b9471f26bb
files mercurial/merge.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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