registrar: move "constant" possiblecmdtypes to class level
While at it, switch to set literal syntax.
Differential Revision: https://phab.mercurial-scm.org/D1187
--- a/mercurial/registrar.py Wed Oct 18 16:28:18 2017 -0700
+++ b/mercurial/registrar.py Wed Oct 18 22:07:53 2017 -0700
@@ -148,13 +148,13 @@
recoverablewrite = "recoverable"
readonly = "readonly"
+ possiblecmdtypes = {unrecoverablewrite, recoverablewrite, readonly}
+
def _doregister(self, func, name, options=(), synopsis=None,
norepo=False, optionalrepo=False, inferrepo=False,
cmdtype=unrecoverablewrite):
- possiblecmdtypes = set([self.unrecoverablewrite, self.recoverablewrite,
- self.readonly])
- if cmdtype not in possiblecmdtypes:
+ if cmdtype not in self.possiblecmdtypes:
raise error.ProgrammingError(_("unknown cmdtype value '%s' for "
"'%s' command") % (cmdtype, name))
func.norepo = norepo