Mercurial > hg-stable
changeset 34341:d8b35920b7b1
dirstate: move filefoldmap to dirstatemap
As part of moving the dirstate storage logic to a separate class, lets move the
filfoldmap computation to that class. This will allow extensions to replace the
dirstate storage with something that persists the filefoldmap.
Differential Revision: https://phab.mercurial-scm.org/D754
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 26 Sep 2017 03:56:20 -0700 |
parents | 4ac04418ce66 |
children | af9722412ac3 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Tue Sep 26 03:56:20 2017 -0700 +++ b/mercurial/dirstate.py Tue Sep 26 03:56:20 2017 -0700 @@ -160,21 +160,7 @@ @propertycache def _filefoldmap(self): - try: - makefilefoldmap = parsers.make_file_foldmap - except AttributeError: - pass - else: - return makefilefoldmap(self._map._map, util.normcasespec, - util.normcasefallback) - - f = {} - normcase = util.normcase - for name, s in self._map.iteritems(): - if s[0] != 'r': - f[normcase(name)] = name - f['.'] = '.' # prevents useless util.fspath() invocation - return f + return self._map.filefoldmap() @propertycache def _dirfoldmap(self): @@ -1370,3 +1356,22 @@ otherparent.add(fname) return nonnorm, otherparent + def filefoldmap(self): + """Returns a dictionary mapping normalized case paths to their + non-normalized versions. + """ + try: + makefilefoldmap = parsers.make_file_foldmap + except AttributeError: + pass + else: + return makefilefoldmap(self._map, util.normcasespec, + util.normcasefallback) + + f = {} + normcase = util.normcase + for name, s in self._map.iteritems(): + if s[0] != 'r': + f[normcase(name)] = name + f['.'] = '.' # prevents useless util.fspath() invocation + return f