Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 44501:87b327de772c
nodemap: refresh the persistent data on nodemap creation
The logic to read the data and validate the docket are still in python, so we
need to "help" whatever compiled code live in the index to refresh it.
Otherwise clearing the cache could lead to an expensive full recomputation and
disk update even when the persisted data are still valid.
Differential Revision: https://phab.mercurial-scm.org/D8174
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 18 Feb 2020 19:11:14 +0100 |
parents | fb16ad368606 |
children | e7fff9c3cdac |
comparison
equal
deleted
inserted
replaced
44498:aa0e1341457b | 44501:87b327de772c |
---|---|
758 def clearcaches(self): | 758 def clearcaches(self): |
759 self._revisioncache = None | 759 self._revisioncache = None |
760 self._chainbasecache.clear() | 760 self._chainbasecache.clear() |
761 self._chunkcache = (0, b'') | 761 self._chunkcache = (0, b'') |
762 self._pcache = {} | 762 self._pcache = {} |
763 self._nodemap_docket = None | |
763 self.index.clearcaches() | 764 self.index.clearcaches() |
765 # The python code is the one responsible for validating the docket, we | |
766 # end up having to refresh it here. | |
767 use_nodemap = ( | |
768 not self._inline | |
769 and self.nodemap_file is not None | |
770 and util.safehasattr(self.index, 'update_nodemap_data') | |
771 ) | |
772 if use_nodemap: | |
773 nodemap_data = nodemaputil.persisted_data(self) | |
774 if nodemap_data is not None: | |
775 self._nodemap_docket = nodemap_data[0] | |
776 self.index.update_nodemap_data(*nodemap_data) | |
764 | 777 |
765 def rev(self, node): | 778 def rev(self, node): |
766 try: | 779 try: |
767 return self.index.rev(node) | 780 return self.index.rev(node) |
768 except TypeError: | 781 except TypeError: |