Patchwork [6,of,6] scmutil: check collision between directory part of added file and tracked ones

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 14, 2013, 4:08 p.m.
Message ID <696e5489dd9576530162.1384445282@juju>
Download mbox | patch
Permalink /patch/2946/
State Superseded
Headers show

Comments

Katsunori FUJIWARA - Nov. 14, 2013, 4:08 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1384438902 -32400
#      Thu Nov 14 23:21:42 2013 +0900
# Node ID 696e5489dd9576530162770c6c8be64dc1a593f5
# Parent  d6fdf886584165c6515f0d8b0a8d69721581488e
scmutil: check collision between directory part of added file and tracked ones

Before this patch, "hg add" doesn't show any warning messages, when
directory part of newly added file causes case-folding collision
against directory part of already tracked ones.

Such adding causes that "hg update" stores files belonging to
different directories in the manifest into same directory in the
working directory unexpectedly on icasefs system.

This patch checks case-folding collision between directory part of
newly added file and already tracked ones.

This patch tests collision detection by multiple path patterns
corresponded to detections in the first, the middle and the last of
"while dparts" loop.

To prevent regression, this patch tests also that collision between
directory part of newly added file and already removed one is ignored.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -116,7 +116,7 @@ 
                 if d in self._newdirs:
                     break
                 dl = '/'.join(dlparts)
-                if self._checkfiles(d, dl):
+                if self._checkfiles(d, dl) or self._checkdirs(d, dl):
                     self._oncollision(f)
                     break
                 dparts.pop()
diff --git a/tests/test-casecollision.t b/tests/test-casecollision.t
--- a/tests/test-casecollision.t
+++ b/tests/test-casecollision.t
@@ -81,6 +81,16 @@ 
   $ hg add J/J4 J/j4
   warning: possible case-folding collision for J/j4
 
+  $ mkdir -p K/K/K1 K/K2 K3 K/K/k1 K/k2/K k3/K/K
+  $ touch K/K/K1/x K/K2/x K3/x K/K/k1/y K/k2/K/y k3/K/K/y
+  $ hg add K/K/K1/x K/K2/x K3/x K/K/k1/y K/k2/K/y k3/K/K/y
+  warning: possible case-folding collision for K/K/k1/y
+  warning: possible case-folding collision for K/k2/K/y
+  warning: possible case-folding collision for k3/K/K/y
+  $ mkdir K/K/K4
+  $ touch K/K/K4/x
+  $ hg add K/K/K4/x
+
   $ hg commit -m '#0'
 
   $ hg remove I/I2/x
@@ -93,6 +103,11 @@ 
   $ hg add J/j4/y
   warning: possible case-folding collision for J/j4/y
 
+  $ hg remove K/K/K4/x
+  $ mkdir K/K/k4
+  $ touch K/K/k4/y
+  $ hg add K/K/k4/y
+
 case changing rename must not warn or abort
 
   $ echo c > c