mercurial/branchmap.py
branchstable
changeset 51651 c0e30a019ce1
parent 51643 f02ec1ecb3bf
child 51859 f4733654f144
equal deleted inserted replaced
51650:d6c895e4adc4 51651:c0e30a019ce1
  1211                 # don't try to use cache - fall back to the slow path
  1211                 # don't try to use cache - fall back to the slow path
  1212                 self.branchinfo = self._branchinfo
  1212                 self.branchinfo = self._branchinfo
  1213 
  1213 
  1214         if self._names:
  1214         if self._names:
  1215             try:
  1215             try:
  1216                 if repo.ui.configbool(b'storage', b'revbranchcache.mmap'):
  1216                 usemmap = repo.ui.configbool(b'storage', b'revbranchcache.mmap')
  1217                     with repo.cachevfs(_rbcrevs) as fp:
  1217                 with repo.cachevfs(_rbcrevs) as fp:
       
  1218                     if usemmap and repo.cachevfs.is_mmap_safe(_rbcrevs):
  1218                         data = util.buffer(util.mmapread(fp))
  1219                         data = util.buffer(util.mmapread(fp))
  1219                 else:
  1220                     else:
  1220                     data = repo.cachevfs.read(_rbcrevs)
  1221                         data = fp.read()
  1221                 self._rbcrevs = rbcrevs(data)
  1222                 self._rbcrevs = rbcrevs(data)
  1222             except (IOError, OSError) as inst:
  1223             except (IOError, OSError) as inst:
  1223                 repo.ui.debug(
  1224                 repo.ui.debug(
  1224                     b"couldn't read revision branch cache: %s\n"
  1225                     b"couldn't read revision branch cache: %s\n"
  1225                     % stringutil.forcebytestr(inst)
  1226                     % stringutil.forcebytestr(inst)