Patchwork D1288: dispatch: filter the repository depending on func.cmdtype

login
register
mail settings
Submitter phabricator
Date Dec. 4, 2017, 2:17 p.m.
Message ID <149b405dc7022216609926760cc5d50a@localhost.localdomain>
Download mbox | patch
Permalink /patch/25927/
State Not Applicable
Headers show

Comments

phabricator - Dec. 4, 2017, 2:17 p.m.
pulkit updated this revision to Diff 4096.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1288?vs=3208&id=4096

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

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

CHANGE DETAILS




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

Patch

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,
@@ -1020,6 +1022,14 @@ 
                 ui = repo.ui
                 if options['hidden']:
                     repo = repo.unfiltered()
+
+                # Accessing hidden commits based on func.cmdtype
+                elif lui.configbool('experimental', 'directaccess'):
+                    if func.cmdtype == readonly:
+                        repo = repo.filtered('visible-allowhidden')
+                    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
@@ -452,6 +452,9 @@ 
 coreconfigitem('experimental', 'crecordtest',
     default=None,
 )
+coreconfigitem('experimental', 'directaccess',
+    default=False,
+)
 coreconfigitem('experimental', 'editortmpinhg',
     default=False,
 )