mercurial/store.py
changeset 50627 e1ee6910f6bc
parent 50514 0925eaf09c8b
child 50628 3ea3767c23a4
equal deleted inserted replaced
50626:9b0fe2b075b5 50627:e1ee6910f6bc
    17 from .thirdparty import attr
    17 from .thirdparty import attr
    18 from .node import hex
    18 from .node import hex
    19 from . import (
    19 from . import (
    20     changelog,
    20     changelog,
    21     error,
    21     error,
       
    22     filelog,
    22     manifest,
    23     manifest,
    23     policy,
    24     policy,
    24     pycompat,
    25     pycompat,
    25     util,
    26     util,
    26     vfs as vfsmod,
    27     vfs as vfsmod,
   542         for ext in sorted(self._details, key=_ext_key):
   543         for ext in sorted(self._details, key=_ext_key):
   543             path = self._path_prefix + ext
   544             path = self._path_prefix + ext
   544             data = self._details[ext]
   545             data = self._details[ext]
   545             files.append(StoreFile(unencoded_path=path, **data))
   546             files.append(StoreFile(unencoded_path=path, **data))
   546         return files
   547         return files
       
   548 
       
   549     def get_revlog_instance(self, repo):
       
   550         """Obtain a revlog instance from this store entry
       
   551 
       
   552         An instance of the appropriate class is returned.
       
   553         """
       
   554         if self.is_changelog:
       
   555             return changelog.changelog(repo.svfs)
       
   556         elif self.is_manifestlog:
       
   557             mandir = self.target_id.rstrip(b'/')
       
   558             return manifest.manifestrevlog(
       
   559                 repo.nodeconstants, repo.svfs, tree=mandir
       
   560             )
       
   561         else:
       
   562             return filelog.filelog(repo.svfs, self.target_id)
   547 
   563 
   548 
   564 
   549 @attr.s(slots=True)
   565 @attr.s(slots=True)
   550 class StoreFile:
   566 class StoreFile:
   551     """a file matching an entry"""
   567     """a file matching an entry"""