Mercurial > public > mercurial-scm > hg
diff mercurial/dispatch.py @ 34781:fe987d0b9e1e
registrar: add support for storing the type of command in func object
This patch adds support for storing the type of command which is going to run in
the func object. For this it does the following:
1) Add three possible values as attributes to the registrar.command class
2) Add a new argument to registrar.command._doregister function
3) Add a new attribute cmdtype to the func object
The type of command will be helpful in deciding what level of access on hidden
commits it can has.
Differential Revision: https://phab.mercurial-scm.org/D736
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 20 Sep 2017 04:47:43 +0530 |
parents | 021607b4ef49 |
children | 7384250eabd9 25c543944bc0 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Mon Oct 16 22:19:02 2017 +0530 +++ b/mercurial/dispatch.py Wed Sep 20 04:47:43 2017 +0530 @@ -35,11 +35,14 @@ hook, profiling, pycompat, + registrar, scmutil, ui as uimod, util, ) +unrecoverablewrite = registrar.command.unrecoverablewrite + class request(object): def __init__(self, args, ui=None, repo=None, fin=None, fout=None, ferr=None, prereposetups=None): @@ -495,7 +498,7 @@ return aliasargs(self.fn, args) def __getattr__(self, name): - adefaults = {r'norepo': True, + adefaults = {r'norepo': True, r'cmdtype': unrecoverablewrite, r'optionalrepo': False, r'inferrepo': False} if name not in adefaults: raise AttributeError(name)