# HG changeset patch # User Martin von Zweigbergk # Date 2017-10-19 05:07:53 # Node ID 7b857c5947ec4afffd7b90a94081098b3706d726 # Parent b63a7d839c33dc55b6477b997834703dc1d3eae5 registrar: move "constant" possiblecmdtypes to class level While at it, switch to set literal syntax. Differential Revision: https://phab.mercurial-scm.org/D1187 diff --git a/mercurial/registrar.py b/mercurial/registrar.py --- a/mercurial/registrar.py +++ b/mercurial/registrar.py @@ -148,13 +148,13 @@ class command(_funcregistrarbase): 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