mercurial/revlogutils/nodemap.py
changeset 46971 a3720569a43f
parent 46794 e2f7b2695ba1
child 47062 f38bf44e077f
equal deleted inserted replaced
46970:99aed233aa8d 46971:a3720569a43f
    51     filename = _rawdata_filepath(revlog, docket)
    51     filename = _rawdata_filepath(revlog, docket)
    52     use_mmap = revlog.opener.options.get(b"persistent-nodemap.mmap")
    52     use_mmap = revlog.opener.options.get(b"persistent-nodemap.mmap")
    53     try:
    53     try:
    54         with revlog.opener(filename) as fd:
    54         with revlog.opener(filename) as fd:
    55             if use_mmap:
    55             if use_mmap:
    56                 data = util.buffer(util.mmapread(fd, data_length))
    56                 try:
       
    57                     data = util.buffer(util.mmapread(fd, data_length))
       
    58                 except ValueError:
       
    59                     # raised when the read file is too small
       
    60                     data = b''
    57             else:
    61             else:
    58                 data = fd.read(data_length)
    62                 data = fd.read(data_length)
    59     except (IOError, OSError) as e:
    63     except (IOError, OSError) as e:
    60         if e.errno == errno.ENOENT:
    64         if e.errno == errno.ENOENT:
    61             return None
    65             return None