310 flag = a[2] |
310 flag = a[2] |
311 util.set_exec(repo.wjoin(f), flag) |
311 util.set_exec(repo.wjoin(f), flag) |
312 |
312 |
313 return updated, merged, removed, unresolved |
313 return updated, merged, removed, unresolved |
314 |
314 |
315 def recordupdates(repo, action, branchmerge, mctx): |
315 def recordupdates(repo, action, branchmerge): |
316 "record merge actions to the dirstate" |
316 "record merge actions to the dirstate" |
317 |
317 |
318 for a in action: |
318 for a in action: |
319 f, m = a[:2] |
319 f, m = a[:2] |
320 if m == "r": # remove |
320 if m == "r": # remove |
333 f2, fd, flag, move = a[2:] |
333 f2, fd, flag, move = a[2:] |
334 if branchmerge: |
334 if branchmerge: |
335 # We've done a branch merge, mark this file as merged |
335 # We've done a branch merge, mark this file as merged |
336 # so that we properly record the merger later |
336 # so that we properly record the merger later |
337 repo.dirstate.update([fd], 'm') |
337 repo.dirstate.update([fd], 'm') |
|
338 if f != f2: # copy/rename |
|
339 if move: |
|
340 repo.dirstate.update([f], 'r') |
|
341 if f != fd: |
|
342 repo.dirstate.copy(f, fd) |
|
343 else: |
|
344 repo.dirstate.copy(f2, fd) |
338 else: |
345 else: |
339 # We've update-merged a locally modified file, so |
346 # We've update-merged a locally modified file, so |
340 # we set the dirstate to emulate a normal checkout |
347 # we set the dirstate to emulate a normal checkout |
341 # of that file some time in the past. Thus our |
348 # of that file some time in the past. Thus our |
342 # merge will appear as a normal local file |
349 # merge will appear as a normal local file |
343 # modification. |
350 # modification. |
344 f_len = mctx.filectx(f).size() |
351 repo.dirstate.update([fd], 'n', st_size=-1, st_mtime=-1) |
345 repo.dirstate.update([fd], 'n', st_size=f_len, st_mtime=-1) |
|
346 if f != f2: # copy/rename |
|
347 if move: |
352 if move: |
348 repo.dirstate.update([f], 'r') |
353 repo.dirstate.forget([f]) |
349 if f != fd: |
|
350 repo.dirstate.copy(f, fd) |
|
351 else: |
|
352 repo.dirstate.copy(f2, fd) |
|
353 |
354 |
354 def update(repo, node, branchmerge, force, partial, wlock): |
355 def update(repo, node, branchmerge, force, partial, wlock): |
355 """ |
356 """ |
356 Perform a merge between the working directory and the given node |
357 Perform a merge between the working directory and the given node |
357 |
358 |
401 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
402 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
402 |
403 |
403 stats = applyupdates(repo, action, wc, p2) |
404 stats = applyupdates(repo, action, wc, p2) |
404 |
405 |
405 if not partial: |
406 if not partial: |
406 recordupdates(repo, action, branchmerge, p2) |
407 recordupdates(repo, action, branchmerge) |
407 repo.dirstate.setparents(fp1, fp2) |
408 repo.dirstate.setparents(fp1, fp2) |
408 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) |
409 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) |
409 |
410 |
410 return stats |
411 return stats |
411 |
412 |