mercurial/dirstate.py
changeset 5326 319c09685f30
parent 5210 90d9ec0dc69d
child 5327 f46ab9cacd3c
equal deleted inserted replaced
5325:5971cfc0a56a 5326:319c09685f30
   173 
   173 
   174     def copies(self):
   174     def copies(self):
   175         return self._copymap
   175         return self._copymap
   176 
   176 
   177     def _incpath(self, path):
   177     def _incpath(self, path):
   178         for c in strutil.findall(path, '/'):
   178         c = path.rfind('/')
   179             pc = path[:c]
   179         if c >= 0:
   180             self._dirs.setdefault(pc, 0)
   180             dirs = self._dirs
   181             self._dirs[pc] += 1
   181             base = path[:c]
       
   182             if base not in dirs:
       
   183                 self._incpath(base)
       
   184                 dirs[base] = 1
       
   185             else:
       
   186                 dirs[base] += 1
   182 
   187 
   183     def _decpath(self, path):
   188     def _decpath(self, path):
   184         for c in strutil.findall(path, '/'):
   189         if "_dirs" in self.__dict__:
   185             pc = path[:c]
   190             c = path.rfind('/')
   186             self._dirs.setdefault(pc, 0)
   191             if c >= 0:
   187             self._dirs[pc] -= 1
   192                 base = path[:c]
       
   193                 dirs = self._dirs
       
   194                 if dirs[base] == 1:
       
   195                     del dirs[base]
       
   196                     self._decpath(base)
       
   197                 else:
       
   198                     dirs[base] -= 1
   188 
   199 
   189     def _incpathcheck(self, f):
   200     def _incpathcheck(self, f):
   190         if '\r' in f or '\n' in f:
   201         if '\r' in f or '\n' in f:
   191             raise util.Abort(_("'\\n' and '\\r' disallowed in filenames"))
   202             raise util.Abort(_("'\\n' and '\\r' disallowed in filenames"))
   192         # shadows
   203         # shadows