Comments
Patch
@@ -337,6 +337,14 @@
return False
return origfn(repo, wctx, mctx, f)
+def overridecheckcollision(orgfn, repo, wmf, actions, prompts, casesensitive,
+ normpath=None):
+ def normlfname(f):
+ if normpath:
+ f = normpath(f)
+ return lfutil.splitstandin(f) or f
+ return orgfn(repo, wmf, actions, prompts, casesensitive, normlfname)
+
# The manifest merge handles conflicts on the manifest level. We want
# to handle changes in largefile-ness of files at this level too.
#
@@ -96,6 +96,8 @@
overrides.overridecat)
entry = extensions.wrapfunction(merge, '_checkunknownfile',
overrides.overridecheckunknownfile)
+ entry = extensions.wrapfunction(merge, '_checkcollision',
+ overrides.overridecheckcollision)
entry = extensions.wrapfunction(merge, 'manifestmerge',
overrides.overridemanifestmerge)
entry = extensions.wrapfunction(filemerge, 'filemerge',
@@ -146,7 +146,7 @@
return actions
-def _checkcollision(repo, wmf, actions, prompts, casesensitive):
+def _checkcollision(repo, wmf, actions, prompts, casesensitive, normpath=None):
# build provisional merged manifest up
pmmf = set(wmf)
@@ -206,18 +206,23 @@
if nf in dirs:
raise util.Abort(_("collision between file %s and "
"other directory") % (f))
- if nf in foldmap:
+ if nf in foldmap and foldmap[nf] != f:
raise util.Abort(_("case-folding collision between %s and %s")
% (f, foldmap[nf]))
foldmap[nf] = f
# check collision in provisional merged manifest
- if normcase:
+ if normpath or normcase:
+ if not normpath:
+ normpath = lambda x: x
+ if not normcase:
+ normcase = lambda x: x
def normiter():
for f in pmmf:
- yield normcase(f)
+ yield normcase(normpath(f))
dirs = scmutil.dirs(normiter())
for f in sorted(pmmf):
+ f = normpath(f)
check(f, normcase(f))
else:
dirs = scmutil.dirs(pmmf)
@@ -214,6 +214,45 @@
abort: collision between file x and other directory
[255]
+test case-folding collision detection between normal file and largefile
+
+ $ cat > .hg/hgrc <<EOF
+ > [extensions]
+ > hgext.largefiles=
+ > EOF
+ $ hg update -q -C 0
+ $ echo X > X
+ $ hg add --large X
+ $ hg commit -m '#6'
+ created new head
+
+ $ hg status -A
+ C X
+ C a
+ $ hg manifest -r 3
+ a
+ x
+ $ hg merge 3
+ abort: case-folding collision between x and X
+ [255]
+ $ hg status -A
+ C X
+ C a
+
+ $ hg update -q -C 3
+ $ hg status -A
+ C a
+ C x
+ $ hg manifest -r 6
+ .hglf/X
+ a
+ $ hg merge 6
+ abort: case-folding collision between x and X
+ [255]
+ $ hg status -A
+ C a
+ C x
+
$ cd ..