changeset 50922:0e6cea0c3113

extension: check the command attributes using `sysstr` Since we are checking attributes, lets use the native representation instead of bytes.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 31 Aug 2023 01:54:48 +0200
parents 538c5a48e8f4
children c642c03969ff
files mercurial/extensions.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/extensions.py	Thu Aug 31 01:47:07 2023 +0200
+++ b/mercurial/extensions.py	Thu Aug 31 01:54:48 2023 +0200
@@ -165,7 +165,7 @@
 
 
 # attributes set by registrar.command
-_cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo')
+_cmdfuncattrs = ('norepo', 'optionalrepo', 'inferrepo')
 
 
 def _validatecmdtable(ui, cmdtable):
@@ -175,10 +175,10 @@
         missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)]
         if not missing:
             continue
-        raise error.ProgrammingError(
-            b'missing attributes: %s' % b', '.join(missing),
-            hint=b"use @command decorator to register '%s'" % c,
-        )
+        msg = b'missing attributes: %s'
+        msg %= b', '.join([stringutil.forcebytestr(m) for m in missing])
+        hint = b"use @command decorator to register '%s'" % c
+        raise error.ProgrammingError(msg, hint=hint)
 
 
 def _validatetables(ui, mod):