safehasattr: pass attribute name as string instead of bytes
This is a step toward replacing `util.safehasattr` usage with plain `hasattr`.
The builtin function behave poorly in Python2 but this was fixed in Python3.
These change are done one by one as they tend to have a small odd to trigger
puzzling breackage.
--- a/mercurial/debugcommands.py Thu Feb 02 17:22:55 2023 +0100
+++ b/mercurial/debugcommands.py Thu Feb 02 17:23:03 2023 +0100
@@ -1943,7 +1943,7 @@
"""show stats related to the changelog index"""
repo.changelog.shortest(repo.nullid, 1)
index = repo.changelog.index
- if not util.safehasattr(index, b'stats'):
+ if not util.safehasattr(index, 'stats'):
raise error.Abort(_(b'debugindexstats only works with native code'))
for k, v in sorted(index.stats().items()):
ui.write(b'%s: %d\n' % (k, v))