mercurial/dirstate.py
changeset 34333 4ac04418ce66
parent 34332 b36881c68569
child 34334 d8b35920b7b1
equal deleted inserted replaced
34332:b36881c68569 34333:4ac04418ce66
    51     try:
    51     try:
    52         return os.fstat(tmpfd).st_mtime
    52         return os.fstat(tmpfd).st_mtime
    53     finally:
    53     finally:
    54         os.close(tmpfd)
    54         os.close(tmpfd)
    55         vfs.unlink(tmpname)
    55         vfs.unlink(tmpname)
    56 
       
    57 def nonnormalentries(dmap):
       
    58     '''Compute the nonnormal dirstate entries from the dmap'''
       
    59     try:
       
    60         return parsers.nonnormalotherparententries(dmap._map)
       
    61     except AttributeError:
       
    62         nonnorm = set()
       
    63         otherparent = set()
       
    64         for fname, e in dmap.iteritems():
       
    65             if e[0] != 'n' or e[3] == -1:
       
    66                 nonnorm.add(fname)
       
    67             if e[0] == 'n' and e[2] == -2:
       
    68                 otherparent.add(fname)
       
    69         return nonnorm, otherparent
       
    70 
    56 
    71 class dirstate(object):
    57 class dirstate(object):
    72 
    58 
    73     def __init__(self, opener, ui, root, validate, sparsematchfn):
    59     def __init__(self, opener, ui, root, validate, sparsematchfn):
    74         '''Create a new dirstate object.
    60         '''Create a new dirstate object.
   160         self._read()
   146         self._read()
   161         return self._identity
   147         return self._identity
   162 
   148 
   163     @propertycache
   149     @propertycache
   164     def _nonnormalset(self):
   150     def _nonnormalset(self):
   165         nonnorm, otherparents = nonnormalentries(self._map)
   151         nonnorm, otherparents = self._map.nonnormalentries()
   166         self._otherparentset = otherparents
   152         self._otherparentset = otherparents
   167         return nonnorm
   153         return nonnorm
   168 
   154 
   169     @propertycache
   155     @propertycache
   170     def _otherparentset(self):
   156     def _otherparentset(self):
   171         nonnorm, otherparents = nonnormalentries(self._map)
   157         nonnorm, otherparents = self._map.nonnormalentries()
   172         self._nonnormalset = nonnorm
   158         self._nonnormalset = nonnorm
   173         return otherparents
   159         return otherparents
   174 
   160 
   175     @propertycache
   161     @propertycache
   176     def _filefoldmap(self):
   162     def _filefoldmap(self):
   841                     now = end # trust our estimate that the end is near now
   827                     now = end # trust our estimate that the end is near now
   842                     break
   828                     break
   843 
   829 
   844         st.write(parsers.pack_dirstate(self._map._map, self._copymap, self._pl,
   830         st.write(parsers.pack_dirstate(self._map._map, self._copymap, self._pl,
   845                                        now))
   831                                        now))
   846         self._nonnormalset, self._otherparentset = nonnormalentries(self._map)
   832         self._nonnormalset, self._otherparentset = self._map.nonnormalentries()
   847         st.close()
   833         st.close()
   848         self._lastnormaltime = 0
   834         self._lastnormaltime = 0
   849         self._dirty = self._dirtypl = False
   835         self._dirty = self._dirtypl = False
   850 
   836 
   851     def _dirignore(self, f):
   837     def _dirignore(self, f):
  1367     def __delitem__(self, key):
  1353     def __delitem__(self, key):
  1368         del self._map[key]
  1354         del self._map[key]
  1369 
  1355 
  1370     def keys(self):
  1356     def keys(self):
  1371         return self._map.keys()
  1357         return self._map.keys()
       
  1358 
       
  1359     def nonnormalentries(self):
       
  1360         '''Compute the nonnormal dirstate entries from the dmap'''
       
  1361         try:
       
  1362             return parsers.nonnormalotherparententries(self._map)
       
  1363         except AttributeError:
       
  1364             nonnorm = set()
       
  1365             otherparent = set()
       
  1366             for fname, e in self._map.iteritems():
       
  1367                 if e[0] != 'n' or e[3] == -1:
       
  1368                     nonnorm.add(fname)
       
  1369                 if e[0] == 'n' and e[2] == -2:
       
  1370                     otherparent.add(fname)
       
  1371             return nonnorm, otherparent
       
  1372