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

Matt Mackall mpm at selenic.com
Tue Mar 31 15:21:25 CDT 2015


On Tue, 2015-03-31 at 15:55 -0400, MHarbison at attotech.com wrote:
> Siddharth Agarwal <sid at less-broken.com> wrote on 03/31/2015 03:35:31 PM:
> 
> > From: Siddharth Agarwal <sid at less-broken.com>
> > To: Matt Harbison <mharbison at attotech.com>, mercurial-devel at selenic.com,
> > Cc: matt_harbison at yahoo.com
> > Date: 03/31/2015 03:36 PM
> > Subject: Re: [PATCH] dirstate: don't require exact case when adding
> > dirs on icasefs (issue4578)
> >
> > 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
> 
> Then the displayed names aren't fully normalized (IDK if that's a good or
> bad thing).  Your change yields this change from the original patch (note
> the directory case):
> 
> $ ./run-tests.py --local test-add.t -i
> 
> --- e:/Projects/hg/tests/test-add.t
> +++ e:/Projects/hg/tests/test-add.t.err
> @@ -177,8 +177,8 @@
>    $ echo def > CapsDir1/CapsDir/SubDir/Def.txt
> 
>    $ hg add -v capsdir1/capsdir
> -  adding CapsDir1/CapsDir/AbC.txt (glob)
> -  adding CapsDir1/CapsDir/SubDir/Def.txt (glob)
> +  adding capsdir1\capsdir\AbC.txt
> +  adding capsdir1\capsdir\SubDir\Def.txt

Yeah, we need to add the names as they appear on the filesystem in this
case.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list