D1142: dispatch: filter the repository depending on func.cmdtype

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Oct 18 12:22:56 EDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc94adbe97ae4: dispatch: filter the repository depending on func.cmdtype (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1142?vs=2904&id=2992

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -42,6 +42,8 @@
 )
 
 unrecoverablewrite = registrar.command.unrecoverablewrite
+recoverablewrite = registrar.command.recoverablewrite
+readonly = registrar.command.readonly
 
 class request(object):
     def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
@@ -927,6 +929,14 @@
                 ui = repo.ui
                 if options['hidden']:
                     repo = repo.unfiltered()
+
+                # Accessing hidden commits based on func.cmdtype
+                if lui.configbool('experimental', 'directaccess'):
+                    if func.cmdtype == readonly:
+                        repo = repo.filtered('visible-hidden')
+                    elif func.cmdtype == recoverablewrite:
+                        repo = repo.filtered('visible-warnhidden')
+
             args.insert(0, repo)
         elif rpath:
             ui.warn(_("warning: --repository ignored\n"))
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -339,6 +339,9 @@
 coreconfigitem('experimental', 'crecordtest',
     default=None,
 )
+coreconfigitem('experimental', 'directaccess',
+    default=False,
+)
 coreconfigitem('experimental', 'editortmpinhg',
     default=False,
 )



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


More information about the Mercurial-devel mailing list