D614: directaccess: make the hiddenlevel an attribute of the function

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Sep 2 17:39:23 UTC 2017


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Making the hiddenlevel a attribute of function will help us in deciding the
  access level in the dispatch and then we will a internal config about the
  directaccess level for the command.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/dispatch.py
  mercurial/registrar.py

CHANGE DETAILS

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -148,6 +148,9 @@
         func.norepo = norepo
         func.optionalrepo = optionalrepo
         func.inferrepo = inferrepo
+        if hiddenlevel not in set([0, 1, 2]):
+            hiddenlevel = 0
+        func.hiddenlevel = hiddenlevel
         if synopsis:
             self._table[name] = func, list(options), synopsis
         else:
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -485,7 +485,7 @@
         return aliasargs(self.fn, args)
 
     def __getattr__(self, name):
-        adefaults = {r'norepo': True,
+        adefaults = {r'norepo': True, r'hiddenlevel': 0,
                      r'optionalrepo': False, r'inferrepo': False}
         if name not in adefaults:
             raise AttributeError(name)



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list