Patchwork D11819: extensions: ignore "sub-options" when looking for extensions

login
register
mail settings
Submitter phabricator
Date Nov. 29, 2021, 4:52 p.m.
Message ID <differential-rev-PHID-DREV-qtmdepvfn6o2a3xc7blw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50146/
State Superseded
Headers show

Comments

phabricator - Nov. 29, 2021, 4:52 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  config suboptions are separated by ":" (see the path one for example). So we
  dont want to confuse these config with actual extensions.
  
  We don't have extensions sub option yet, but I am about to introduce one for
  making sure an extensions can load. So lets level the floor first.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/extensions.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -282,6 +282,7 @@ 
     result = ui.configitems(b"extensions")
     if whitelist is not None:
         result = [(k, v) for (k, v) in result if k in whitelist]
+    result = [(k, v) for (k, v) in result if b':' not in k]
     newindex = len(_order)
     ui.log(
         b'extension',
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1281,7 +1281,7 @@ 
 )
 coreconfigitem(
     b'extensions',
-    b'.*',
+    b'[^:]*',
     default=None,
     generic=True,
 )