Mercurial > public > mercurial-scm > hg-stable
diff hgext/largefiles/overrides.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 | 34a27addc286 |
children | ea3343104f07 |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Thu Dec 08 15:33:19 2022 +0100 +++ b/hgext/largefiles/overrides.py Thu Aug 31 23:56:15 2023 +0200 @@ -1167,7 +1167,7 @@ @eh.wrapcommand(b'rebase', extension=b'rebase') def overriderebasecmd(orig, ui, repo, **opts): - if not util.safehasattr(repo, '_largefilesenabled'): + if not hasattr(repo, '_largefilesenabled'): return orig(ui, repo, **opts) resuming = opts.get('continue') @@ -1298,7 +1298,7 @@ # allow only hgsubrepos to set this, instead of the current scheme # where the parent sets this for the child. with ( - util.safehasattr(sub, '_repo') + hasattr(sub, '_repo') and lfstatus(sub._repo) or util.nullcontextmanager() ): @@ -1309,7 +1309,7 @@ @eh.wrapfunction(subrepo.hgsubrepo, 'archive') def hgsubrepoarchive(orig, repo, archiver, prefix, match=None, decode=True): - lfenabled = util.safehasattr(repo._repo, '_largefilesenabled') + lfenabled = hasattr(repo._repo, '_largefilesenabled') if not lfenabled or not repo._repo.lfstatus: return orig(repo, archiver, prefix, match, decode) @@ -1364,7 +1364,7 @@ # would allow only hgsubrepos to set this, instead of the current scheme # where the parent sets this for the child. with ( - util.safehasattr(sub, '_repo') + hasattr(sub, '_repo') and lfstatus(sub._repo) or util.nullcontextmanager() ):