comparison mercurial/merge.py @ 3257:c93ce7f10f85

merge: fixes for merge+rename findcopies: ignore files renamed on both branches applyupdates: change remove flag to move recordupdates: record copy actions, including local moves and deletions
author Matt Mackall <mpm@selenic.com>
date Wed, 04 Oct 2006 19:08:04 -0500
parents f05c182430a0
children ae85272b59a4
comparison
equal deleted inserted replaced
3256:7c114915fbdb 3257:c93ce7f10f85
149 149
150 def checkpair(c, f2, man): 150 def checkpair(c, f2, man):
151 ''' check if an apparent pair actually matches ''' 151 ''' check if an apparent pair actually matches '''
152 c2 = ctx(f2, man[f2]) 152 c2 = ctx(f2, man[f2])
153 ca = c.ancestor(c2) 153 ca = c.ancestor(c2)
154 if ca: 154 if ca and ca.path() == c.path() or ca.path() == c2.path():
155 copy[c.path()] = f2 155 copy[c.path()] = f2
156 copy[f2] = c.path() 156 copy[f2] = c.path()
157 157
158 for f in u1: 158 for f in u1:
159 c = ctx(dcopies.get(f, f), m1[f]) 159 c = ctx(dcopies.get(f, f), m1[f])
282 if inst.errno != errno.ENOENT: 282 if inst.errno != errno.ENOENT:
283 repo.ui.warn(_("update failed to remove %s: %s!\n") % 283 repo.ui.warn(_("update failed to remove %s: %s!\n") %
284 (f, inst.strerror)) 284 (f, inst.strerror))
285 removed +=1 285 removed +=1
286 elif m == "c": # copy 286 elif m == "c": # copy
287 f2, fd, my, other, flag, remove = a[2:] 287 f2, fd, my, other, flag, move = a[2:]
288 if filemerge(repo, f, f2, fd, my, other, xp1, xp2, remove): 288 if filemerge(repo, f, f2, fd, my, other, xp1, xp2, move):
289 unresolved += 1 289 unresolved += 1
290 util.set_exec(repo.wjoin(fd), flag) 290 util.set_exec(repo.wjoin(fd), flag)
291 merged += 1 291 merged += 1
292 elif m == "m": # merge 292 elif m == "m": # merge
293 flag, my, other = a[2:] 293 flag, my, other = a[2:]
337 # merge will appear as a normal local file 337 # merge will appear as a normal local file
338 # modification. 338 # modification.
339 fl = repo.file(f) 339 fl = repo.file(f)
340 f_len = fl.size(fl.rev(other)) 340 f_len = fl.size(fl.rev(other))
341 repo.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1) 341 repo.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1)
342 elif m == "c": # copy
343 f2, fd, my, other, flag, move = a[2:]
344 if branchmerge:
345 # We've done a branch merge, mark this file as merged
346 # so that we properly record the merger later
347 repo.dirstate.update([fd], 'm')
348 else:
349 # We've update-merged a locally modified file, so
350 # we set the dirstate to emulate a normal checkout
351 # of that file some time in the past. Thus our
352 # merge will appear as a normal local file
353 # modification.
354 fl = repo.file(f)
355 f_len = fl.size(fl.rev(other))
356 repo.dirstate.update([fd], 'n', st_size=f_len, st_mtime=-1)
357 if move:
358 repo.dirstate.update([f], 'r')
359 if f != fd:
360 repo.dirstate.copy(f, fd)
342 361
343 def update(repo, node, branchmerge=False, force=False, partial=None, 362 def update(repo, node, branchmerge=False, force=False, partial=None,
344 wlock=None, show_stats=True, remind=True): 363 wlock=None, show_stats=True, remind=True):
345 364
346 overwrite = force and not branchmerge 365 overwrite = force and not branchmerge