Show More
@@ -10,7 +10,7 from i18n import gettext as _ | |||||
10 | from demandload import * |
|
10 | from demandload import * | |
11 | demandload(globals(), "errno util os tempfile") |
|
11 | demandload(globals(), "errno util os tempfile") | |
12 |
|
12 | |||
13 |
def filemerge(repo, fw, fo, fd, my, other, |
|
13 | def filemerge(repo, fw, fo, fd, my, other, wctx, mctx, move): | |
14 | """perform a 3-way merge in the working directory |
|
14 | """perform a 3-way merge in the working directory | |
15 |
|
15 | |||
16 | fw = filename in the working directory and first parent |
|
16 | fw = filename in the working directory and first parent | |
@@ -18,7 +18,7 def filemerge(repo, fw, fo, fd, my, othe | |||||
18 | fd = destination filename |
|
18 | fd = destination filename | |
19 | my = fileid in first parent |
|
19 | my = fileid in first parent | |
20 | other = fileid in second parent |
|
20 | other = fileid in second parent | |
21 | p1, p2 = hex changeset ids for merge command |
|
21 | wctx, mctx = working and merge changecontexts | |
22 | move = whether to move or copy the file to the destination |
|
22 | move = whether to move or copy the file to the destination | |
23 |
|
23 | |||
24 | TODO: |
|
24 | TODO: | |
@@ -50,8 +50,8 def filemerge(repo, fw, fo, fd, my, othe | |||||
50 | or "hgmerge") |
|
50 | or "hgmerge") | |
51 | r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=repo.root, |
|
51 | r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=repo.root, | |
52 | environ={'HG_FILE': fw, |
|
52 | environ={'HG_FILE': fw, | |
53 |
'HG_MY_NODE': |
|
53 | 'HG_MY_NODE': str(wctx.parents()[0]), | |
54 |
'HG_OTHER_NODE': |
|
54 | 'HG_OTHER_NODE': str(mctx)}) | |
55 | if r: |
|
55 | if r: | |
56 | repo.ui.warn(_("merging %s failed!\n") % fw) |
|
56 | repo.ui.warn(_("merging %s failed!\n") % fw) | |
57 | else: |
|
57 | else: | |
@@ -275,7 +275,7 def manifestmerge(repo, p1, p2, pa, over | |||||
275 |
|
275 | |||
276 | return action |
|
276 | return action | |
277 |
|
277 | |||
278 |
def applyupdates(repo, action, x |
|
278 | def applyupdates(repo, action, wctx, mctx): | |
279 | updated, merged, removed, unresolved = 0, 0, 0, 0 |
|
279 | updated, merged, removed, unresolved = 0, 0, 0, 0 | |
280 | action.sort() |
|
280 | action.sort() | |
281 | for a in action: |
|
281 | for a in action: | |
@@ -295,14 +295,14 def applyupdates(repo, action, xp1, xp2) | |||||
295 | elif m == "c": # copy |
|
295 | elif m == "c": # copy | |
296 | f2, fd, my, other, flag, move = a[2:] |
|
296 | f2, fd, my, other, flag, move = a[2:] | |
297 | repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd)) |
|
297 | repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd)) | |
298 |
if filemerge(repo, f, f2, fd, my, other, x |
|
298 | if filemerge(repo, f, f2, fd, my, other, wctx, mctx, move): | |
299 | unresolved += 1 |
|
299 | unresolved += 1 | |
300 | util.set_exec(repo.wjoin(fd), flag) |
|
300 | util.set_exec(repo.wjoin(fd), flag) | |
301 | merged += 1 |
|
301 | merged += 1 | |
302 | elif m == "m": # merge |
|
302 | elif m == "m": # merge | |
303 | flag, my, other = a[2:] |
|
303 | flag, my, other = a[2:] | |
304 | repo.ui.status(_("merging %s\n") % f) |
|
304 | repo.ui.status(_("merging %s\n") % f) | |
305 |
if filemerge(repo, f, f, f, my, other, x |
|
305 | if filemerge(repo, f, f, f, my, other, wctx, mctx, False): | |
306 | unresolved += 1 |
|
306 | unresolved += 1 | |
307 | util.set_exec(repo.wjoin(f), flag) |
|
307 | util.set_exec(repo.wjoin(f), flag) | |
308 | merged += 1 |
|
308 | merged += 1 | |
@@ -433,7 +433,7 def update(repo, node, branchmerge=False | |||||
433 | if not partial: |
|
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, |
|
436 | updated, merged, removed, unresolved = applyupdates(repo, action, wc, p2) | |
437 |
|
437 | |||
438 | # update dirstate |
|
438 | # update dirstate | |
439 | if not partial: |
|
439 | if not partial: |
General Comments 0
You need to be logged in to leave comments.
Login now