mercurial/dirstate.py
changeset 32750 b698921ee137
parent 32682 e696f597d02f
child 32772 7ad95626f6a7
equal deleted inserted replaced
32749:b5524fd9a4e3 32750:b698921ee137
   157     def _copymap(self):
   157     def _copymap(self):
   158         self._read()
   158         self._read()
   159         return self._copymap
   159         return self._copymap
   160 
   160 
   161     @propertycache
   161     @propertycache
       
   162     def _identity(self):
       
   163         self._read()
       
   164         return self._identity
       
   165 
       
   166     @propertycache
   162     def _nonnormalset(self):
   167     def _nonnormalset(self):
   163         nonnorm, otherparents = nonnormalentries(self._map)
   168         nonnorm, otherparents = nonnormalentries(self._map)
   164         self._otherparentset = otherparents
   169         self._otherparentset = otherparents
   165         return nonnorm
   170         return nonnorm
   166 
   171 
   424         return fp
   429         return fp
   425 
   430 
   426     def _read(self):
   431     def _read(self):
   427         self._map = {}
   432         self._map = {}
   428         self._copymap = {}
   433         self._copymap = {}
       
   434         # ignore HG_PENDING because identity is used only for writing
       
   435         self._identity = util.filestat(self._opener.join(self._filename))
   429         try:
   436         try:
   430             fp = self._opendirstatefile()
   437             fp = self._opendirstatefile()
   431             try:
   438             try:
   432                 st = fp.read()
   439                 st = fp.read()
   433             finally:
   440             finally:
   474 
   481 
   475         This is different from localrepo.invalidatedirstate() because it always
   482         This is different from localrepo.invalidatedirstate() because it always
   476         rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
   483         rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
   477         check whether the dirstate has changed before rereading it.'''
   484         check whether the dirstate has changed before rereading it.'''
   478 
   485 
   479         for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
   486         for a in ("_map", "_copymap", "_identity",
       
   487                   "_filefoldmap", "_dirfoldmap", "_branch",
   480                   "_pl", "_dirs", "_ignore", "_nonnormalset",
   488                   "_pl", "_dirs", "_ignore", "_nonnormalset",
   481                   "_otherparentset"):
   489                   "_otherparentset"):
   482             if a in self.__dict__:
   490             if a in self.__dict__:
   483                 delattr(self, a)
   491                 delattr(self, a)
   484         self._lastnormaltime = 0
   492         self._lastnormaltime = 0
   738                 self.normallookup(f)
   746                 self.normallookup(f)
   739             else:
   747             else:
   740                 self.drop(f)
   748                 self.drop(f)
   741 
   749 
   742         self._dirty = True
   750         self._dirty = True
       
   751 
       
   752     def identity(self):
       
   753         '''Return identity of dirstate itself to detect changing in storage
       
   754 
       
   755         If identity of previous dirstate is equal to this, writing
       
   756         changes based on the former dirstate out can keep consistency.
       
   757         '''
       
   758         return self._identity
   743 
   759 
   744     def write(self, tr):
   760     def write(self, tr):
   745         if not self._dirty:
   761         if not self._dirty:
   746             return
   762             return
   747 
   763