D1187: registrar: move "constant" possiblecmdtypes to class level
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Oct 19 05:22:45 UTC 2017
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
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
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list