summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/mercurial-hg-extension-path.patch
blob: 8b9d185a89a479ae2eb5ed5f38c57a1032b91b47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
This is needed to make Mercurial read the HGEXTENSIONPATH to detect
third-party extensions.  It is called HGEXTENSIONPATH and not
HG_EXTENSION_PATH to keep it consistent with other environment variables for
Mercurial, e.g. HGENCODINGAMBIGUOUS, HGEDITOR ...  Hopefully I or someone else
will get this into Mercurial proper.

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -103,6 +103,11 @@
 
 def _importh(name):
     """import and return the <name> module"""
+    # Read HGEXTENSIONSPATH environment variable when import extensions.
+    extension_path = os.getenv("HGEXTENSIONSPATH")
+    if extension_path is not None:
+        for path in extension_path:
+            sys.path.append(path)
     mod = __import__(name)
     components = name.split('.')
     for comp in components[1:]: