Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 6805:482581431dcd
Sort removes first when applying updates (fixes issues 750 and 912)
This change ensures that removes happen first in applyupdates(). This avoids
issues where we try to make a case-only rename of a file on a case insensitive
system. Without this patch, the add of the new name happens before the remove
of the old one - which results in the file not existing, as the two names are
effectively the same.
With the patch, the old name gets removed then the new one gets added, which
is always safe.
author | Paul Moore <p.f.moore@gmail.com> |
---|---|
date | Tue, 01 Jul 2008 17:59:31 +0100 |
parents | f67d1468ac50 |
children | 11229144aa01 |
comparison
equal
deleted
inserted
replaced
6804:694223a29ad4 | 6805:482581431dcd |
---|---|
256 else: | 256 else: |
257 act("remote created", "g", f, m2.flags(f)) | 257 act("remote created", "g", f, m2.flags(f)) |
258 | 258 |
259 return action | 259 return action |
260 | 260 |
261 def actioncmp(a1, a2): | |
262 m1 = a1[1] | |
263 m2 = a2[1] | |
264 if m1 == m2: | |
265 return cmp(a1, a2) | |
266 if m1 == 'r': | |
267 return -1 | |
268 if m2 == 'r': | |
269 return 1 | |
270 return cmp(a1, a2) | |
271 | |
261 def applyupdates(repo, action, wctx, mctx): | 272 def applyupdates(repo, action, wctx, mctx): |
262 "apply the merge action list to the working directory" | 273 "apply the merge action list to the working directory" |
263 | 274 |
264 updated, merged, removed, unresolved = 0, 0, 0, 0 | 275 updated, merged, removed, unresolved = 0, 0, 0, 0 |
265 ms = mergestate(repo) | 276 ms = mergestate(repo) |
266 ms.reset(wctx.parents()[0].node()) | 277 ms.reset(wctx.parents()[0].node()) |
267 moves = [] | 278 moves = [] |
268 action.sort() | 279 action.sort(actioncmp) |
269 | 280 |
270 # prescan for merges | 281 # prescan for merges |
271 for a in action: | 282 for a in action: |
272 f, m = a[:2] | 283 f, m = a[:2] |
273 if m == 'm': # merge | 284 if m == 'm': # merge |