Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 26661:2b955fec91e0
merge: abort on file/directory case folding collisions (issue4892)
File/directory case folding collisions cannot be represented on case folding
systems and have to fail.
To detect this and abort early, utilize that for file/directory collisions, a
sorted list of case folded manifest names will have the colliding directory
right after the file.
(This could perhaps be optimized, but this way of doing it also has
directory/directory case folding in mind ... which however not is handled yet.)
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 13 Oct 2015 00:16:25 +0200 |
parents | d58f2f0e2b19 |
children | 08b068240a1a |
comparison
equal
deleted
inserted
replaced
26660:7e1baad90121 | 26661:2b955fec91e0 |
---|---|
475 fold = util.normcase(f) | 475 fold = util.normcase(f) |
476 if fold in foldmap: | 476 if fold in foldmap: |
477 raise error.Abort(_("case-folding collision between %s and %s") | 477 raise error.Abort(_("case-folding collision between %s and %s") |
478 % (f, foldmap[fold])) | 478 % (f, foldmap[fold])) |
479 foldmap[fold] = f | 479 foldmap[fold] = f |
480 | |
481 # check case-folding of directories | |
482 foldprefix = unfoldprefix = lastfull = '' | |
483 for fold, f in sorted(foldmap.items()): | |
484 if fold.startswith(foldprefix) and not f.startswith(unfoldprefix): | |
485 # the folded prefix matches but actual casing is different | |
486 raise error.Abort(_("case-folding collision between " | |
487 "%s and directory of %s") % (lastfull, f)) | |
488 foldprefix = fold + '/' | |
489 unfoldprefix = f + '/' | |
490 lastfull = f | |
480 | 491 |
481 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial, | 492 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial, |
482 acceptremote, followcopies): | 493 acceptremote, followcopies): |
483 """ | 494 """ |
484 Merge p1 and p2 with ancestor pa and generate merge action list | 495 Merge p1 and p2 with ancestor pa and generate merge action list |