mercurial/localrepo.py
changeset 17124 f1b7683f3f95
parent 17075 28ed1c4511ce
child 17125 95d785ccb4e5
equal deleted inserted replaced
17123:8e030168b09e 17124:f1b7683f3f95
   191     def _phasecache(self):
   191     def _phasecache(self):
   192         return phases.phasecache(self, self._phasedefaults)
   192         return phases.phasecache(self, self._phasedefaults)
   193 
   193 
   194     @storecache('obsstore')
   194     @storecache('obsstore')
   195     def obsstore(self):
   195     def obsstore(self):
   196         store = obsolete.obsstore()
   196         store = obsolete.obsstore(self.sopener)
   197         data = self.sopener.tryread('obsstore')
       
   198         if data:
       
   199             store.loadmarkers(data)
       
   200         return store
   197         return store
   201 
   198 
   202     @storecache('00changelog.i')
   199     @storecache('00changelog.i')
   203     def changelog(self):
   200     def changelog(self):
   204         c = changelog.changelog(self.sopener)
   201         c = changelog.changelog(self.sopener)
   988 
   985 
   989         def unlock():
   986         def unlock():
   990             self.store.write()
   987             self.store.write()
   991             if '_phasecache' in vars(self):
   988             if '_phasecache' in vars(self):
   992                 self._phasecache.write()
   989                 self._phasecache.write()
   993             if 'obsstore' in vars(self) and self.obsstore._new:
   990             if 'obsstore' in vars(self):
   994                 # XXX: transaction logic should be used here. But for
   991                 self.obsstore.flushmarkers()
   995                 # now rewriting the whole file is good enough.
       
   996                 f = self.sopener('obsstore', 'wb', atomictemp=True)
       
   997                 try:
       
   998                     self.obsstore.flushmarkers(f)
       
   999                     f.close()
       
  1000                 except: # re-raises
       
  1001                     f.discard()
       
  1002                     raise
       
  1003             for k, ce in self._filecache.items():
   992             for k, ce in self._filecache.items():
  1004                 if k == 'dirstate':
   993                 if k == 'dirstate':
  1005                     continue
   994                     continue
  1006                 ce.refresh()
   995                 ce.refresh()
  1007 
   996