# HG changeset patch # User Martin von Zweigbergk # Date 2017-05-18 23:05:46 # Node ID 2dac9d6a0af9f8b8ab6abcf1f5081f33b66ee4fa # Parent 0ec4cd6fe0511e3cf60f6ab93e5a851c3bea6f70 match: don't print explicitly listed files with wrong case (BC) On case-insensitive file systems, if file A exists and you try to remove it (or add, etc.) by specifying a different case, you will see something like this: $ hg rm a removing file A I honestly found this surprising because it seems to me like it was explicitly listed by the user. Still, there is a comment in the code describing it, so it is very clearly intentional. The code was added in baa11dde8c0e (match: add a subclass for dirstate normalizing of the matched patterns, 2015-04-12). I'm going to do a lot of refactoring to matchers and the feature mentioned above is going to get in my way. I'm therefore removing it for the time being and we can hopefully add it back when I'm done. diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -450,19 +450,11 @@ class icasefsmatcher(matcher): init(root, cwd, patterns, include, exclude, default, auditor=auditor, ctx=ctx, listsubrepos=listsubrepos, badfn=badfn) - # m.exact(file) must be based off of the actual user input, otherwise - # inexact case matches are treated as exact, and not noted without -v. - if self._files: - roots, dirs = _rootsanddirs(self._kp) - self._fileset = set(roots) - self._fileset.update(dirs) - def _normalize(self, patterns, default, root, cwd, auditor, warn): - self._kp = super(icasefsmatcher, self)._normalize(patterns, default, - root, cwd, auditor, - warn) + kp = super(icasefsmatcher, self)._normalize(patterns, default, root, + cwd, auditor, warn) kindpats = [] - for kind, pats, source in self._kp: + for kind, pats, source in kp: if kind not in ('re', 'relre'): # regex can't be normalized p = pats pats = self._dsnormalize(pats) diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -196,7 +196,6 @@ Test that adding a directory doesn't req adding CapsDir1/CapsDir/SubDir/Def.txt (glob) $ hg forget capsdir1/capsdir/abc.txt - removing CapsDir1/CapsDir/AbC.txt (glob) $ hg forget capsdir1/capsdir removing CapsDir1/CapsDir/SubDir/Def.txt (glob) @@ -232,7 +231,6 @@ and OS X +def $ hg mv CapsDir1/CapsDir/abc.txt CapsDir1/CapsDir/ABC.txt - moving CapsDir1/CapsDir/AbC.txt to CapsDir1/CapsDir/ABC.txt (glob) $ hg ci -m "case changing rename" CapsDir1/CapsDir/AbC.txt CapsDir1/CapsDir/ABC.txt $ hg status -A capsdir1/capsdir diff --git a/tests/test-casefolding.t b/tests/test-casefolding.t --- a/tests/test-casefolding.t +++ b/tests/test-casefolding.t @@ -9,7 +9,6 @@ test file addition with bad case $ cd repo1 $ echo a > a $ hg add A - adding a $ hg st A a $ hg ci -m adda @@ -71,14 +70,12 @@ test changing case of path components A D/c $ hg ci -m addc D/c $ hg mv d/b d/e - moving D/b to D/e (glob) $ hg st A D/e R D/b $ hg revert -aq $ rm d/e $ hg mv d/b D/B - moving D/b to D/B (glob) $ hg st A D/B R D/b