changeset 34895:7b857c5947ec

registrar: move "constant" possiblecmdtypes to class level While at it, switch to set literal syntax. Differential Revision: https://phab.mercurial-scm.org/D1187
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 18 Oct 2017 22:07:53 -0700
parents b63a7d839c33
children 97017508c863
files mercurial/registrar.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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