[PATCH 1 of 2] extensions: allow loading a whitelisted subset of extensions

Jun Wu quark at fb.com
Mon May 22 08:24:44 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1495439516 25200
#      Mon May 22 00:51:56 2017 -0700
# Node ID fe8b1338edacf98cb13c2be6bdce2823836f1e44
# Parent  4e51b2a99847904f1cc5a9c74784f19d69e829d0
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r fe8b1338edac
extensions: allow loading a whitelisted subset of extensions

This feature will be used by the next patch.

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -180,6 +180,8 @@ def _runextsetup(name, ui):
             extsetup() # old extsetup with no ui argument
 
-def loadall(ui):
+def loadall(ui, whitelist=None):
     result = ui.configitems("extensions")
+    if whitelist:
+        result = [(k, v) for (k, v) in result if k in whitelist]
     newindex = len(_order)
     for (name, path) in result:


More information about the Mercurial-devel mailing list