Mercurial > hg
comparison mercurial/cmdutil.py @ 50928: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 | 1270677d740b |
children | 18c8c18993f0 |
comparison
equal
deleted
inserted
replaced
50927:7a8ea1397816 | 50928:d718eddf01d9 |
---|---|
1447 # Not all storage may be revlogs. If requested, try to return an actual | 1447 # Not all storage may be revlogs. If requested, try to return an actual |
1448 # revlog instance. | 1448 # revlog instance. |
1449 if returnrevlog: | 1449 if returnrevlog: |
1450 if isinstance(r, revlog.revlog): | 1450 if isinstance(r, revlog.revlog): |
1451 pass | 1451 pass |
1452 elif util.safehasattr(r, '_revlog'): | 1452 elif hasattr(r, '_revlog'): |
1453 r = r._revlog # pytype: disable=attribute-error | 1453 r = r._revlog # pytype: disable=attribute-error |
1454 elif r is not None: | 1454 elif r is not None: |
1455 raise error.InputError( | 1455 raise error.InputError( |
1456 _(b'%r does not appear to be a revlog') % r | 1456 _(b'%r does not appear to be a revlog') % r |
1457 ) | 1457 ) |