##// END OF EJS Templates
dirstate-map: factor out the change to _dirs and _alldirs on dropping...
marmoute -
r48488:b37ab6b5 default
parent child Browse files
Show More
@@ -155,6 +155,17 b' class dirstatemap(object):'
155 if old_entry is None and "_alldirs" in self.__dict__:
155 if old_entry is None and "_alldirs" in self.__dict__:
156 self._alldirs.addpath(filename)
156 self._alldirs.addpath(filename)
157
157
158 def _dirs_decr(self, filename, old_entry=None):
159 """decremente the dirstate counter if applicable"""
160 if old_entry is not None:
161 if "_dirs" in self.__dict__ and not old_entry.removed:
162 self._dirs.delpath(filename)
163 if "_alldirs" in self.__dict__:
164 self._alldirs.delpath(filename)
165 if "filefoldmap" in self.__dict__:
166 normed = util.normcase(filename)
167 self.filefoldmap.pop(normed, None)
168
158 def addfile(
169 def addfile(
159 self,
170 self,
160 f,
171 f,
@@ -247,21 +258,9 b' class dirstatemap(object):'
247 previously recorded.
258 previously recorded.
248 """
259 """
249 old_entry = self._map.pop(f, None)
260 old_entry = self._map.pop(f, None)
250 exists = False
261 self._dirs_decr(f, old_entry=old_entry)
251 oldstate = b'?'
252 if old_entry is not None:
253 exists = True
254 oldstate = old_entry.state
255 if exists:
256 if oldstate != b"r" and "_dirs" in self.__dict__:
257 self._dirs.delpath(f)
258 if "_alldirs" in self.__dict__:
259 self._alldirs.delpath(f)
260 if "filefoldmap" in self.__dict__:
261 normed = util.normcase(f)
262 self.filefoldmap.pop(normed, None)
263 self.nonnormalset.discard(f)
262 self.nonnormalset.discard(f)
264 return exists
263 return old_entry is not None
265
264
266 def clearambiguoustimes(self, files, now):
265 def clearambiguoustimes(self, files, now):
267 for f in files:
266 for f in files:
General Comments 0
You need to be logged in to leave comments. Login now