comparison mercurial/dirstatemap.py @ 47539:84391ddf4c78

dirstate-item: rename the class to DirstateItem The object is no longer a tuple, so it seems clearer to rename it (and its associated method) Differential Revision: https://phab.mercurial-scm.org/D10982
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 04 Jul 2021 22:27:29 +0200
parents 6025353c9c55
children b8013cb71ef3
comparison
equal deleted inserted replaced
47538:77fce401a2bb 47539:84391ddf4c78
21 parsers = policy.importmod('parsers') 21 parsers = policy.importmod('parsers')
22 rustmod = policy.importrust('dirstate') 22 rustmod = policy.importrust('dirstate')
23 23
24 propertycache = util.propertycache 24 propertycache = util.propertycache
25 25
26 dirstatetuple = parsers.dirstatetuple 26 DirstateItem = parsers.DirstateItem
27 27
28 28
29 # a special value used internally for `size` if the file come from the other parent 29 # a special value used internally for `size` if the file come from the other parent
30 FROM_P2 = -2 30 FROM_P2 = -2
31 31
192 old_entry is None or old_entry.removed 192 old_entry is None or old_entry.removed
193 ) and "_dirs" in self.__dict__: 193 ) and "_dirs" in self.__dict__:
194 self._dirs.addpath(f) 194 self._dirs.addpath(f)
195 if old_entry is None and "_alldirs" in self.__dict__: 195 if old_entry is None and "_alldirs" in self.__dict__:
196 self._alldirs.addpath(f) 196 self._alldirs.addpath(f)
197 self._map[f] = dirstatetuple(state, mode, size, mtime) 197 self._map[f] = DirstateItem(state, mode, size, mtime)
198 if state != b'n' or mtime == AMBIGUOUS_TIME: 198 if state != b'n' or mtime == AMBIGUOUS_TIME:
199 self.nonnormalset.add(f) 199 self.nonnormalset.add(f)
200 if size == FROM_P2: 200 if size == FROM_P2:
201 self.otherparentset.add(f) 201 self.otherparentset.add(f)
202 202
230 if entry is None and "_alldirs" in self.__dict__: 230 if entry is None and "_alldirs" in self.__dict__:
231 self._alldirs.addpath(f) 231 self._alldirs.addpath(f)
232 if "filefoldmap" in self.__dict__: 232 if "filefoldmap" in self.__dict__:
233 normed = util.normcase(f) 233 normed = util.normcase(f)
234 self.filefoldmap.pop(normed, None) 234 self.filefoldmap.pop(normed, None)
235 self._map[f] = dirstatetuple(b'r', 0, size, 0) 235 self._map[f] = DirstateItem(b'r', 0, size, 0)
236 self.nonnormalset.add(f) 236 self.nonnormalset.add(f)
237 237
238 def dropfile(self, f): 238 def dropfile(self, f):
239 """ 239 """
240 Remove a file from the dirstate. Returns True if the file was 240 Remove a file from the dirstate. Returns True if the file was
259 259
260 def clearambiguoustimes(self, files, now): 260 def clearambiguoustimes(self, files, now):
261 for f in files: 261 for f in files:
262 e = self.get(f) 262 e = self.get(f)
263 if e is not None and e[0] == b'n' and e[3] == now: 263 if e is not None and e[0] == b'n' and e[3] == now:
264 self._map[f] = dirstatetuple(e[0], e[1], e[2], AMBIGUOUS_TIME) 264 self._map[f] = DirstateItem(e[0], e[1], e[2], AMBIGUOUS_TIME)
265 self.nonnormalset.add(f) 265 self.nonnormalset.add(f)
266 266
267 def nonnormalentries(self): 267 def nonnormalentries(self):
268 '''Compute the nonnormal dirstate entries from the dmap''' 268 '''Compute the nonnormal dirstate entries from the dmap'''
269 try: 269 try: