comparison mercurial/help.py @ 50925: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 822320591c46
children 18c8c18993f0
comparison
equal deleted inserted replaced
50924:7a8ea1397816 50925:d718eddf01d9
41 revset, 41 revset,
42 templatefilters, 42 templatefilters,
43 templatefuncs, 43 templatefuncs,
44 templatekw, 44 templatekw,
45 ui as uimod, 45 ui as uimod,
46 util,
47 ) 46 )
48 from .hgweb import webcommands 47 from .hgweb import webcommands
49 from .utils import ( 48 from .utils import (
50 compression, 49 compression,
51 resourceutil, 50 resourceutil,
808 807
809 # description 808 # description
810 doc = gettext(pycompat.getdoc(entry[0])) 809 doc = gettext(pycompat.getdoc(entry[0]))
811 if not doc: 810 if not doc:
812 doc = _(b"(no help text available)") 811 doc = _(b"(no help text available)")
813 if util.safehasattr(entry[0], 'definition'): # aliased command 812 if hasattr(entry[0], 'definition'): # aliased command
814 source = entry[0].source 813 source = entry[0].source
815 if entry[0].definition.startswith(b'!'): # shell alias 814 if entry[0].definition.startswith(b'!'): # shell alias
816 doc = _(b'shell alias for: %s\n\n%s\n\ndefined by: %s\n') % ( 815 doc = _(b'shell alias for: %s\n\n%s\n\ndefined by: %s\n') % (
817 entry[0].definition[1:], 816 entry[0].definition[1:],
818 doc, 817 doc,