match: don't print explicitly listed files with wrong case (BC)
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 18 May 2017 16:05:46 -0700
changeset 32398 2dac9d6a0af9
parent 32397 0ec4cd6fe051
child 32399 1c1f7c946666
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.
mercurial/match.py
tests/test-add.t
tests/test-casefolding.t
--- a/mercurial/match.py	Thu May 18 15:25:16 2017 -0700
+++ b/mercurial/match.py	Thu May 18 16:05:46 2017 -0700
@@ -450,19 +450,11 @@
         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)
--- a/tests/test-add.t	Thu May 18 15:25:16 2017 -0700
+++ b/tests/test-add.t	Thu May 18 16:05:46 2017 -0700
@@ -196,7 +196,6 @@
   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 @@
   +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
--- a/tests/test-casefolding.t	Thu May 18 15:25:16 2017 -0700
+++ b/tests/test-casefolding.t	Thu May 18 16:05:46 2017 -0700
@@ -9,7 +9,6 @@
   $ cd repo1
   $ echo a > a
   $ hg add A
-  adding a
   $ hg st
   A a
   $ hg ci -m adda
@@ -71,14 +70,12 @@
   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