[PATCH] issue 1286

Adrian Buehlmann adrian at cadifra.com
Thu Sep 4 13:48:43 CDT 2008


On 04.09.2008 20:06, Petr Kodl wrote:
> # HG changeset patch
> # User Petr Kodl <petrkodl at gmail.com>
> # Date 1220551484 14400
> # Node ID 0a891c8181c57954a83751022cbab830a65beab0
> # Parent  6c4a08270222569ba906f4f1c7860783eec19225
> issue 1286
> 
> diff -r 6c4a08270222 -r 0a891c8181c5 mercurial/dirstate.py
> --- a/mercurial/dirstate.py	Wed Sep 03 19:03:57 2008 +0200
> +++ b/mercurial/dirstate.py	Thu Sep 04 14:04:44 2008 -0400
> @@ -42,10 +42,11 @@
>              return self._copymap
>          elif name == '_foldmap':
>              _foldmap = {}
> -            for name in self._map:
> -                norm = os.path.normcase(os.path.normpath(name))
> -                _foldmap[norm] = name
> -            self._foldmap = _foldmap
> +            if self._checkcase:
> +                for name in self._map:
> +                    norm = os.path.normcase(os.path.normpath(name))
> +                    _foldmap[norm] = name
> +                self._foldmap = _foldmap
>              return self._foldmap
>          elif name == '_branch':
>              try:

Scratching my head...

why would this have any effect (besides adding confusion
for the code reader)?

_foldmap is only accessed in _normalize, which is only
aliased to "normalize" if _checkcase is True (quoting line 93):

'''
        elif name == 'normalize':
            if self._checkcase:
                self.normalize = self._normalize
            else:
                self.normalize = lambda x: x
            return self.normalize
'''

In short, if we access _foldmap, _checkcase is always true.

Or what did I miss here?




More information about the Mercurial-devel mailing list