comparison mercurial/merge.py @ 3302: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
comparison
equal deleted inserted replaced
3301:72d1e521da77 3302:20087b4bc6f9
423 action += manifestmerge(repo, wc, p2, pa, overwrite, partial) 423 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
424 424
425 ### apply phase 425 ### apply phase
426 426
427 if not branchmerge: 427 if not branchmerge:
428 # we don't need to do any magic, just jump to the new rev 428 # just jump to the new rev
429 p1, p2 = p2, repo.changectx(nullid) 429 fp1, fp2, xp1, xp2 = p2.node(), nullid, str(p2), ''
430 430 else:
431 xp1, xp2 = str(p1), str(p2) 431 fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
432 if not p2: xp2 = '' 432
433 433 if not partial:
434 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) 434 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
435 435
436 updated, merged, removed, unresolved = applyupdates(repo, action, xp1, xp2) 436 updated, merged, removed, unresolved = applyupdates(repo, action, xp1, xp2)
437 437
438 # update dirstate 438 # update dirstate
439 if not partial: 439 if not partial:
440 recordupdates(repo, action, branchmerge) 440 recordupdates(repo, action, branchmerge)
441 repo.dirstate.setparents(p1.node(), p2.node()) 441 repo.dirstate.setparents(fp1, fp2)
442 repo.hook('update', parent1=xp1, parent2=xp2, error=unresolved)
442 443
443 if show_stats: 444 if show_stats:
444 stats = ((updated, _("updated")), 445 stats = ((updated, _("updated")),
445 (merged - unresolved, _("merged")), 446 (merged - unresolved, _("merged")),
446 (removed, _("removed")), 447 (removed, _("removed")),
459 repo.ui.status(_("(branch merge, don't forget to commit)\n")) 460 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
460 elif unresolved: 461 elif unresolved:
461 repo.ui.status(_("There are unresolved merges with" 462 repo.ui.status(_("There are unresolved merges with"
462 " locally modified files.\n")) 463 " locally modified files.\n"))
463 464
464 repo.hook('update', parent1=xp1, parent2=xp2, error=unresolved)
465 return unresolved 465 return unresolved
466 466