Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 44363:671f9479af0e
nodemap: provide the on disk data to indexes who support it
Time to start defining the API and prepare the rust index support. We provide
a method to do so. We use a distinct method instead of passing them in the
constructor because we will need this method anyway later (to refresh the mmap
once we update the data on disk).
Differential Revision: https://phab.mercurial-scm.org/D7847
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 15 Jan 2020 15:49:16 +0100 |
parents | 6f9e8e142cea |
children | 76a96e3a2bbb |
comparison
equal
deleted
inserted
replaced
44362:d58206b70199 | 44363:671f9479af0e |
---|---|
624 self._io = NodemapRevlogIO() | 624 self._io = NodemapRevlogIO() |
625 elif rustrevlog is not None and self.opener.options.get(b'rust.index'): | 625 elif rustrevlog is not None and self.opener.options.get(b'rust.index'): |
626 self._io = rustrevlogio() | 626 self._io = rustrevlogio() |
627 try: | 627 try: |
628 d = self._io.parseindex(indexdata, self._inline) | 628 d = self._io.parseindex(indexdata, self._inline) |
629 index, _chunkcache = d | |
630 use_nodemap = ( | |
631 not self._inline | |
632 and self.nodemap_file is not None | |
633 and util.safehasattr(index, 'update_nodemap_data') | |
634 ) | |
635 if use_nodemap: | |
636 nodemap_data = nodemaputil.persisted_data(self) | |
637 if nodemap_data is not None: | |
638 index.update_nodemap_data(nodemap_data) | |
629 except (ValueError, IndexError): | 639 except (ValueError, IndexError): |
630 raise error.RevlogError( | 640 raise error.RevlogError( |
631 _(b"index %s is corrupted") % self.indexfile | 641 _(b"index %s is corrupted") % self.indexfile |
632 ) | 642 ) |
633 self.index, self._chunkcache = d | 643 self.index, self._chunkcache = d |