comparison mercurial/dirstate.py @ 47482:eb416759af7e

dirstate: Removed unused instances of `DirsMultiset` … in Rust-backed dirstatemap. The Python class `dirstatemap` had cached properties `_dirs` and `_alldirs` that were not used for `hastrackeddir` and `hasdir` since they were redundant with corresponding fields for the Rust `DirstateMap` struct. `dirfoldmap` is modified to reuse instead the directory iterator introduced in 3b9914b28133c0918186b6e8b9e4f1916e21338d. Differential Revision: https://phab.mercurial-scm.org/D10921
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 28 Jun 2021 15:52:10 +0200
parents 3b9914b28133
children e6b303eb8f7d
comparison
equal deleted inserted replaced
47481:f23eafb036af 47482:eb416759af7e
1949 non-normalized versions. 1949 non-normalized versions.
1950 """ 1950 """
1951 return self._rustmap.filefoldmapasdict() 1951 return self._rustmap.filefoldmapasdict()
1952 1952
1953 def hastrackeddir(self, d): 1953 def hastrackeddir(self, d):
1954 self._dirs # Trigger Python's propertycache
1955 return self._rustmap.hastrackeddir(d) 1954 return self._rustmap.hastrackeddir(d)
1956 1955
1957 def hasdir(self, d): 1956 def hasdir(self, d):
1958 self._dirs # Trigger Python's propertycache
1959 return self._rustmap.hasdir(d) 1957 return self._rustmap.hasdir(d)
1960
1961 @propertycache
1962 def _dirs(self):
1963 return self._rustmap.getdirs()
1964
1965 @propertycache
1966 def _alldirs(self):
1967 return self._rustmap.getalldirs()
1968 1958
1969 @propertycache 1959 @propertycache
1970 def identity(self): 1960 def identity(self):
1971 self._rustmap 1961 self._rustmap
1972 return self.identity 1962 return self.identity
1986 1976
1987 @propertycache 1977 @propertycache
1988 def dirfoldmap(self): 1978 def dirfoldmap(self):
1989 f = {} 1979 f = {}
1990 normcase = util.normcase 1980 normcase = util.normcase
1991 for name in self._dirs: 1981 for name, _pseudo_entry in self.directories():
1992 f[normcase(name)] = name 1982 f[normcase(name)] = name
1993 return f 1983 return f