Mercurial > hg
comparison mercurial/match.py @ 32398:2dac9d6a0af9
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.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 18 May 2017 16:05:46 -0700 |
parents | 0ec4cd6fe051 |
children | 1c1f7c946666 |
comparison
equal
deleted
inserted
replaced
32397:0ec4cd6fe051 | 32398:2dac9d6a0af9 |
---|---|
448 self._dsnormalize = self._dirstate.normalize | 448 self._dsnormalize = self._dirstate.normalize |
449 | 449 |
450 init(root, cwd, patterns, include, exclude, default, auditor=auditor, | 450 init(root, cwd, patterns, include, exclude, default, auditor=auditor, |
451 ctx=ctx, listsubrepos=listsubrepos, badfn=badfn) | 451 ctx=ctx, listsubrepos=listsubrepos, badfn=badfn) |
452 | 452 |
453 # m.exact(file) must be based off of the actual user input, otherwise | |
454 # inexact case matches are treated as exact, and not noted without -v. | |
455 if self._files: | |
456 roots, dirs = _rootsanddirs(self._kp) | |
457 self._fileset = set(roots) | |
458 self._fileset.update(dirs) | |
459 | |
460 def _normalize(self, patterns, default, root, cwd, auditor, warn): | 453 def _normalize(self, patterns, default, root, cwd, auditor, warn): |
461 self._kp = super(icasefsmatcher, self)._normalize(patterns, default, | 454 kp = super(icasefsmatcher, self)._normalize(patterns, default, root, |
462 root, cwd, auditor, | 455 cwd, auditor, warn) |
463 warn) | |
464 kindpats = [] | 456 kindpats = [] |
465 for kind, pats, source in self._kp: | 457 for kind, pats, source in kp: |
466 if kind not in ('re', 'relre'): # regex can't be normalized | 458 if kind not in ('re', 'relre'): # regex can't be normalized |
467 p = pats | 459 p = pats |
468 pats = self._dsnormalize(pats) | 460 pats = self._dsnormalize(pats) |
469 | 461 |
470 # Preserve the original to handle a case only rename. | 462 # Preserve the original to handle a case only rename. |