comparison mercurial/merge.py @ 16001:fcf66193b186 stable

merge: defer symlink flag merging to filemerge (issue3200) Previously, we could change a normal file into a corrupt symlink when trying to merge a symlink flag. Now, we leave the flag alone and let filemerge deal with it (usually by a prompt). We also drop a redundant flag setting after filemerge (now dealt with by ms.resolve) that would cause similar corruption.
author Matt Mackall <mpm@selenic.com>
date Thu, 26 Jan 2012 20:34:57 -0600
parents 44fa047cef57
children 914bc95e227b ca5cc2976574
comparison
equal deleted inserted replaced
16000:25fa240139cb 16001:fcf66193b186
171 return "l" # Symlink 171 return "l" # Symlink
172 return "" 172 return ""
173 if m and m != a: # changed from a to m 173 if m and m != a: # changed from a to m
174 return m 174 return m
175 if n and n != a: # changed from a to n 175 if n and n != a: # changed from a to n
176 if n == 'l' or a == 'l':
177 # can't automatically merge symlink flag change here, let
178 # filemerge take care of it
179 return m
176 return n 180 return n
177 return '' # flag was cleared 181 return '' # flag was cleared
178 182
179 def act(msg, m, f, *args): 183 def act(msg, m, f, *args):
180 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) 184 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
357 else: 361 else:
358 if r is None: 362 if r is None:
359 updated += 1 363 updated += 1
360 else: 364 else:
361 merged += 1 365 merged += 1
362 util.setflags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
363 if (move and repo.dirstate.normalize(fd) != f 366 if (move and repo.dirstate.normalize(fd) != f
364 and os.path.lexists(repo.wjoin(f))): 367 and os.path.lexists(repo.wjoin(f))):
365 repo.ui.debug("removing %s\n" % f) 368 repo.ui.debug("removing %s\n" % f)
366 audit(f) 369 audit(f)
367 os.unlink(repo.wjoin(f)) 370 os.unlink(repo.wjoin(f))