Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.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 | b3174be5e7f7 |
children | 18c8c18993f0 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Dec 08 15:33:19 2022 +0100 +++ b/mercurial/localrepo.py Thu Aug 31 23:56:15 2023 +0200 @@ -420,7 +420,7 @@ try: bundle = exchange.readbundle(self.ui, bundle, None) ret = exchange.unbundle(self._repo, bundle, heads, b'push', url) - if util.safehasattr(ret, 'getchunks'): + if hasattr(ret, 'getchunks'): # This is a bundle20 object, turn it into an unbundler. # This little dance should be dropped eventually when the # API is finally improved. @@ -1461,7 +1461,7 @@ if self.ui.configbool(b'devel', b'all-warnings') or self.ui.configbool( b'devel', b'check-locks' ): - if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs + if hasattr(self.svfs, 'vfs'): # this is filtervfs self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit) else: # standard vfs self.svfs.audit = self._getsvfsward(self.svfs.audit) @@ -1523,8 +1523,8 @@ repo = rref() if ( repo is None - or not util.safehasattr(repo, '_wlockref') - or not util.safehasattr(repo, '_lockref') + or not hasattr(repo, '_wlockref') + or not hasattr(repo, '_lockref') ): return if mode in (None, b'r', b'rb'): @@ -1572,7 +1572,7 @@ def checksvfs(path, mode=None): ret = origfunc(path, mode=mode) repo = rref() - if repo is None or not util.safehasattr(repo, '_lockref'): + if repo is None or not hasattr(repo, '_lockref'): return if mode in (None, b'r', b'rb'): return