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

login
register
mail settings
Submitter Jun Wu
Date May 22, 2017, 8:24 a.m.
Message ID <fe8b1338edacf98cb13c.1495441484@x1c>
Download mbox | patch
Permalink /patch/20823/
State Accepted
Headers show

Comments

Jun Wu - May 22, 2017, 8:24 a.m.
# HG changeset patch
# User Jun Wu <quark@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.

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: