Patchwork D9989: gendoc: add support for loading extensions from config settings

login
register
mail settings
Submitter phabricator
Date Feb. 12, 2021, 8:05 p.m.
Message ID <differential-rev-PHID-DREV-3dha4lclmh437nj4y6uv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48304/
State Superseded
Headers show

Comments

phabricator - Feb. 12, 2021, 8:05 p.m.
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We manage our installation and ship some extensions, enabled by default for our
  users, that are in hgext3rd or other directories not scanned by this tool by
  default. We want to generate docs during the build process, and having those
  docs include the extensions that users don't have to manually enable is
  desirable.
  
  This is *not* desirable for the normal build process, however, and should never
  be enabled by default.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  doc/gendoc.py

CHANGE DETAILS




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

Patch

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -330,6 +330,11 @@ 
         doc = encoding.strtolocal(sys.argv[1])
 
     ui = uimod.ui.load()
+    # Trigger extensions to load. This is disabled by default because it uses
+    # the current user's configuration, which is often not what is wanted.
+    if encoding.environ.get(b'GENDOC_LOAD_CONFIGURED_EXTENSIONS', b'0') != b'0':
+        extensions.loadall(ui)
+
     if doc == b'hg.1.gendoc':
         showdoc(ui)
     else: