[PATCH] dirstate: don't require exact case when adding dirs on icasefs (issue4578)

Siddharth Agarwal sid at less-broken.com
Tue Mar 31 14:35:31 CDT 2015


On 03/31/2015 10:53 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1427814699 14400
> #      Tue Mar 31 11:11:39 2015 -0400
> # Node ID c92f9acf447de31a6fe51ac664c26c42032117fd
> # Parent  888dcab69ca3fe817786a7078bb1f66afa203c8b
> dirstate: don't require exact case when adding dirs on icasefs (issue4578)
>
> We don't require it when adding files on a case insensitive filesystem, so don't
> require it to add directories for consistency.
>
> The problem with the previous code was that _walkexplicit() was only returning
> the normalized directory.  The file(s) in the directory are then appended, and
> passed to the matcher.  But if the user asks for 'capsdir1/capsdir', the matcher
> will not accept 'CapsDir1/CapsDir/AbC.txt', and the name is dropped.  Matching
> based on the non-normalized name is required.
>
> If not normalizing, skip the extra string building for efficiency.  '.' is
> replaced with '' so that the path being tested when no file is specified, isn't
> prefixed with './' (and therefore fail the match).
>
> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> --- a/mercurial/dirstate.py
> +++ b/mercurial/dirstate.py
> @@ -652,7 +652,7 @@ class dirstate(object):
>                          results[nf] = None
>                      if matchedir:
>                          matchedir(nf)
> -                    foundadd(nf)
> +                    foundadd((nf, ff))

Actually, the 'work' list can just be non-normalized files
(foundadd(ff)). AFAICT there's no reason, correctness or performance
wise, that we need to add normalized files to work.

- Siddharth


More information about the Mercurial-devel mailing list