changeset 3303:69b9471f26bb

merge: pass contexts to applyupdates
author Matt Mackall <mpm@selenic.com>
date Mon, 09 Oct 2006 20:32:03 -0500
parents 20087b4bc6f9
children 45f0c49f0449
files mercurial/merge.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Mon Oct 09 18:13:38 2006 -0500
+++ b/mercurial/merge.py	Mon Oct 09 20:32:03 2006 -0500
@@ -10,7 +10,7 @@
 from demandload import *
 demandload(globals(), "errno util os tempfile")
 
-def filemerge(repo, fw, fo, fd, my, other, p1, p2, move):
+def filemerge(repo, fw, fo, fd, my, other, wctx, mctx, move):
     """perform a 3-way merge in the working directory
 
     fw = filename in the working directory and first parent
@@ -18,7 +18,7 @@
     fd = destination filename
     my = fileid in first parent
     other = fileid in second parent
-    p1, p2 = hex changeset ids for merge command
+    wctx, mctx = working and merge changecontexts
     move = whether to move or copy the file to the destination
 
     TODO:
@@ -50,8 +50,8 @@
            or "hgmerge")
     r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=repo.root,
                     environ={'HG_FILE': fw,
-                             'HG_MY_NODE': p1,
-                             'HG_OTHER_NODE': p2})
+                             'HG_MY_NODE': str(wctx.parents()[0]),
+                             'HG_OTHER_NODE': str(mctx)})
     if r:
         repo.ui.warn(_("merging %s failed!\n") % fw)
     else:
@@ -275,7 +275,7 @@
 
     return action
 
-def applyupdates(repo, action, xp1, xp2):
+def applyupdates(repo, action, wctx, mctx):
     updated, merged, removed, unresolved = 0, 0, 0, 0
     action.sort()
     for a in action:
@@ -295,14 +295,14 @@
         elif m == "c": # copy
             f2, fd, my, other, flag, move = a[2:]
             repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
-            if filemerge(repo, f, f2, fd, my, other, xp1, xp2, move):
+            if filemerge(repo, f, f2, fd, my, other, wctx, mctx, move):
                 unresolved += 1
             util.set_exec(repo.wjoin(fd), flag)
             merged += 1
         elif m == "m": # merge
             flag, my, other = a[2:]
             repo.ui.status(_("merging %s\n") % f)
-            if filemerge(repo, f, f, f, my, other, xp1, xp2, False):
+            if filemerge(repo, f, f, f, my, other, wctx, mctx, False):
                 unresolved += 1
             util.set_exec(repo.wjoin(f), flag)
             merged += 1
@@ -433,7 +433,7 @@
     if not partial:
         repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
 
-    updated, merged, removed, unresolved = applyupdates(repo, action, xp1, xp2)
+    updated, merged, removed, unresolved = applyupdates(repo, action, wc, p2)
 
     # update dirstate
     if not partial: