Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 50951:d718eddf01d9
safehasattr: drop usage in favor of hasattr
The two functions should now be equivalent at least in their usage in core.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 31 Aug 2023 23:56:15 +0200 |
parents | 4a3a9d961561 |
children | 18c8c18993f0 |
line wrap: on
line diff
--- a/mercurial/revlog.py Thu Dec 08 15:33:19 2022 +0100 +++ b/mercurial/revlog.py Thu Aug 31 23:56:15 2023 +0200 @@ -167,7 +167,7 @@ # We also consider we have a "fast" implementation in "pure" python because # people using pure don't really have performance consideration (and a # wheelbarrow of other slowness source) -HAS_FAST_PERSISTENT_NODEMAP = rustrevlog is not None or util.safehasattr( +HAS_FAST_PERSISTENT_NODEMAP = rustrevlog is not None or hasattr( parsers, 'BaseIndexObject' ) @@ -214,7 +214,7 @@ return index, cache -if util.safehasattr(parsers, 'parse_index_devel_nodemap'): +if hasattr(parsers, 'parse_index_devel_nodemap'): def parse_index_v1_nodemap(data, inline): index, cache = parsers.parse_index_devel_nodemap(data, inline) @@ -730,7 +730,7 @@ use_nodemap = ( not self._inline and self._nodemap_file is not None - and util.safehasattr(index, 'update_nodemap_data') + and hasattr(index, 'update_nodemap_data') ) if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) @@ -911,7 +911,7 @@ use_nodemap = ( not self._inline and self._nodemap_file is not None - and util.safehasattr(self.index, 'update_nodemap_data') + and hasattr(self.index, 'update_nodemap_data') ) if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) @@ -1887,7 +1887,7 @@ """tells whether rev is a snapshot""" if not self._sparserevlog: return self.deltaparent(rev) == nullrev - elif util.safehasattr(self.index, 'issnapshot'): + elif hasattr(self.index, 'issnapshot'): # directly assign the method to cache the testing and access self.issnapshot = self.index.issnapshot return self.issnapshot(rev)