comparison mercurial/revlog.py @ 47164:04f2f94836a5

revlog: rename `nodemap_file` to `_nodemap_file` Same reasoning as for `indexfile and datafile`, lets hide these implementation details. Differential Revision: https://phab.mercurial-scm.org/D10590
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:25:01 +0200
parents 6bc7c467a7d1
children 590f2364d33a
comparison
equal deleted inserted replaced
47163:6bc7c467a7d1 47164:04f2f94836a5
325 indexfile = b'%s.i.%s' % (self.radix, postfix) 325 indexfile = b'%s.i.%s' % (self.radix, postfix)
326 datafile = b'%s.d.%s' % (self.radix, postfix) 326 datafile = b'%s.d.%s' % (self.radix, postfix)
327 327
328 self._indexfile = indexfile 328 self._indexfile = indexfile
329 self._datafile = datafile 329 self._datafile = datafile
330 self.nodemap_file = None 330 self._nodemap_file = None
331 self.postfix = postfix 331 self.postfix = postfix
332 self.opener = opener 332 self.opener = opener
333 if persistentnodemap: 333 if persistentnodemap:
334 self.nodemap_file = nodemaputil.get_nodemap_file(self) 334 self._nodemap_file = nodemaputil.get_nodemap_file(self)
335 335
336 assert target[0] in ALL_KINDS 336 assert target[0] in ALL_KINDS
337 assert len(target) == 2 337 assert len(target) == 2
338 self.target = target 338 self.target = target
339 # When True, indexfile is opened with checkambig=True at writing, to 339 # When True, indexfile is opened with checkambig=True at writing, to
534 self._sparserevlog = False 534 self._sparserevlog = False
535 535
536 self._storedeltachains = True 536 self._storedeltachains = True
537 537
538 devel_nodemap = ( 538 devel_nodemap = (
539 self.nodemap_file 539 self._nodemap_file
540 and force_nodemap 540 and force_nodemap
541 and parse_index_v1_nodemap is not None 541 and parse_index_v1_nodemap is not None
542 ) 542 )
543 543
544 use_rust_index = False 544 use_rust_index = False
545 if rustrevlog is not None: 545 if rustrevlog is not None:
546 if self.nodemap_file is not None: 546 if self._nodemap_file is not None:
547 use_rust_index = True 547 use_rust_index = True
548 else: 548 else:
549 use_rust_index = self.opener.options.get(b'rust.index') 549 use_rust_index = self.opener.options.get(b'rust.index')
550 550
551 self._parse_index = parse_index_v1 551 self._parse_index = parse_index_v1
560 try: 560 try:
561 d = self._parse_index(indexdata, self._inline) 561 d = self._parse_index(indexdata, self._inline)
562 index, _chunkcache = d 562 index, _chunkcache = d
563 use_nodemap = ( 563 use_nodemap = (
564 not self._inline 564 not self._inline
565 and self.nodemap_file is not None 565 and self._nodemap_file is not None
566 and util.safehasattr(index, 'update_nodemap_data') 566 and util.safehasattr(index, 'update_nodemap_data')
567 ) 567 )
568 if use_nodemap: 568 if use_nodemap:
569 nodemap_data = nodemaputil.persisted_data(self) 569 nodemap_data = nodemaputil.persisted_data(self)
570 if nodemap_data is not None: 570 if nodemap_data is not None:
696 ): 696 ):
697 return False 697 return False
698 return True 698 return True
699 699
700 def update_caches(self, transaction): 700 def update_caches(self, transaction):
701 if self.nodemap_file is not None: 701 if self._nodemap_file is not None:
702 if transaction is None: 702 if transaction is None:
703 nodemaputil.update_persistent_nodemap(self) 703 nodemaputil.update_persistent_nodemap(self)
704 else: 704 else:
705 nodemaputil.setup_persistent_nodemap(transaction, self) 705 nodemaputil.setup_persistent_nodemap(transaction, self)
706 706
713 self.index.clearcaches() 713 self.index.clearcaches()
714 # The python code is the one responsible for validating the docket, we 714 # The python code is the one responsible for validating the docket, we
715 # end up having to refresh it here. 715 # end up having to refresh it here.
716 use_nodemap = ( 716 use_nodemap = (
717 not self._inline 717 not self._inline
718 and self.nodemap_file is not None 718 and self._nodemap_file is not None
719 and util.safehasattr(self.index, 'update_nodemap_data') 719 and util.safehasattr(self.index, 'update_nodemap_data')
720 ) 720 )
721 if use_nodemap: 721 if use_nodemap:
722 nodemap_data = nodemaputil.persisted_data(self) 722 nodemap_data = nodemaputil.persisted_data(self)
723 if nodemap_data is not None: 723 if nodemap_data is not None: