Patchwork D1187: registrar: move "constant" possiblecmdtypes to class level

login
register
mail settings
Submitter phabricator
Date Oct. 19, 2017, 3:11 p.m.
Message ID <68dbce34e89d9b019051d3863b05e2c5@localhost.localdomain>
Download mbox | patch
Permalink /patch/25245/
State Not Applicable
Headers show

Comments

phabricator - Oct. 19, 2017, 3:11 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3ade6ca6e3ed: registrar: move &quot;constant&quot; possiblecmdtypes to class level (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1187?vs=3023&id=3033

REVISION DETAIL
  https://phab.mercurial-scm.org/D1187

AFFECTED FILES
  mercurial/registrar.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, quark, lothiraldan, durin42
Cc: lothiraldan, mercurial-devel

Patch

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -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