mercurial/localrepo.py
branchstable
changeset 16198 fa8488565afd
parent 16144 4546a8513dcd
child 16200 9d4a2942a732
equal deleted inserted replaced
16196:8ae7626d8bf1 16198:fa8488565afd
    16 import tags as tagsmod
    16 import tags as tagsmod
    17 from lock import release
    17 from lock import release
    18 import weakref, errno, os, time, inspect
    18 import weakref, errno, os, time, inspect
    19 propertycache = util.propertycache
    19 propertycache = util.propertycache
    20 filecache = scmutil.filecache
    20 filecache = scmutil.filecache
       
    21 
       
    22 class storecache(filecache):
       
    23     """filecache for files in the store"""
       
    24     def join(self, obj, fname):
       
    25         return obj.sjoin(fname)
    21 
    26 
    22 class localrepository(repo.repository):
    27 class localrepository(repo.repository):
    23     capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
    28     capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
    24                         'known', 'getbundle'))
    29                         'known', 'getbundle'))
    25     supportedformats = set(('revlogv1', 'generaldelta'))
    30     supportedformats = set(('revlogv1', 'generaldelta'))
   174         return bookmarks.readcurrent(self)
   179         return bookmarks.readcurrent(self)
   175 
   180 
   176     def _writebookmarks(self, marks):
   181     def _writebookmarks(self, marks):
   177       bookmarks.write(self)
   182       bookmarks.write(self)
   178 
   183 
   179     @filecache('phaseroots', True)
   184     @storecache('phaseroots')
   180     def _phaseroots(self):
   185     def _phaseroots(self):
   181         self._dirtyphases = False
   186         self._dirtyphases = False
   182         phaseroots = phases.readroots(self)
   187         phaseroots = phases.readroots(self)
   183         phases.filterunknown(self, phaseroots)
   188         phases.filterunknown(self, phaseroots)
   184         return phaseroots
   189         return phaseroots
   193                     cache[rev] = phase
   198                     cache[rev] = phase
   194                 for rev in self.changelog.descendants(*roots):
   199                 for rev in self.changelog.descendants(*roots):
   195                     cache[rev] = phase
   200                     cache[rev] = phase
   196         return cache
   201         return cache
   197 
   202 
   198     @filecache('00changelog.i', True)
   203     @storecache('00changelog.i')
   199     def changelog(self):
   204     def changelog(self):
   200         c = changelog.changelog(self.sopener)
   205         c = changelog.changelog(self.sopener)
   201         if 'HG_PENDING' in os.environ:
   206         if 'HG_PENDING' in os.environ:
   202             p = os.environ['HG_PENDING']
   207             p = os.environ['HG_PENDING']
   203             if p.startswith(self.root):
   208             if p.startswith(self.root):
   204                 c.readpending('00changelog.i.a')
   209                 c.readpending('00changelog.i.a')
   205         return c
   210         return c
   206 
   211 
   207     @filecache('00manifest.i', True)
   212     @storecache('00manifest.i')
   208     def manifest(self):
   213     def manifest(self):
   209         return manifest.manifest(self.sopener)
   214         return manifest.manifest(self.sopener)
   210 
   215 
   211     @filecache('dirstate')
   216     @filecache('dirstate')
   212     def dirstate(self):
   217     def dirstate(self):