D4889: narrow: introduce a config option to check if narrow is enabled or not

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Fri Oct 5 20:17:12 UTC 2018


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

REVISION SUMMARY
  This patch introduces a new config option experimental.narrow which is set to
  False by default and set to True by the narrow extension.
  
  While moving narrow related logic into core, we need to know at places whether
  narrow extension is enabled or not. Checking the list of extension enabled is
  one solution but once narrow is inbuilt, we will definitely want a config option
  to check whether narrow is turned on or not.
  
  So this patch introduces a config option, which will evolve to the main point to
  turn narrow capability on and off once all the narrow is in core.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/narrow/__init__.py
  mercurial/configitems.py

CHANGE DETAILS

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -538,6 +538,9 @@
 coreconfigitem('experimental', 'mmapindexthreshold',
     default=None,
 )
+coreconfigitem('experimental', 'narrow',
+    default=False,
+)
 coreconfigitem('experimental', 'nonnormalparanoidcheck',
     default=False,
 )
diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -62,6 +62,7 @@
     if not repo.local():
         return
 
+    repo.ui.setconfig('experimental', 'narrow', True, 'narrow-ext')
     if repository.NARROW_REQUIREMENT in repo.requirements:
         narrowrepo.wraprepo(repo)
         narrowwirepeer.reposetup(repo)



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


More information about the Mercurial-devel mailing list