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

login
register
mail settings
Submitter phabricator
Date Oct. 19, 2017, 5:22 a.m.
Message ID <differential-rev-PHID-DREV-a54q7xk2wrmpjqo6v4nz-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25231/
State Superseded
Headers show

Comments

phabricator - Oct. 19, 2017, 5:22 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  While at it, swithc to set literal syntax.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/registrar.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 19, 2017, 6:48 a.m.
lothiraldan requested changes to this revision.
lothiraldan added a comment.
This revision now requires changes to proceed.


  Typo in the commit message `swithc`

REPOSITORY
  rHG Mercurial

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

To: martinvonz, #hg-reviewers, quark, lothiraldan
Cc: lothiraldan, mercurial-devel
phabricator - Oct. 19, 2017, 6:57 a.m.
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D1187#20013, @lothiraldan wrote:
  
  > Typo in the commit message `swithc`
  
  
  Done

REPOSITORY
  rHG Mercurial

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

To: martinvonz, #hg-reviewers, quark, lothiraldan
Cc: lothiraldan, mercurial-devel
phabricator - Oct. 19, 2017, 7:41 a.m.
lothiraldan accepted this revision.
lothiraldan added a comment.


  Looks good to me now

REPOSITORY
  rHG Mercurial

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

To: martinvonz, #hg-reviewers, quark, lothiraldan
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