[PATCH 2 of 4 v2] extensions.load: return module

Erik Zielke ez at aragost.com
Tue Oct 19 07:03:42 CDT 2010


# HG changeset patch
# User Erik Zielke <ez at aragost.com>
# Date 1287488620 -7200
# Node ID 0e7c866b2ac6ea5e55c81178dee0b27b0fd18f40
# Parent  27dd9da7536f8c3efdcf8511b662447b4e73a2a7
extensions.load: return module

Makes extensions.load return the module that
it has loaded.

This is done so that callers can get information on this module, which
e.g. can be used for generating docs.

diff -r 27dd9da7536f -r 0e7c866b2ac6 mercurial/extensions.py
--- a/mercurial/extensions.py	Tue Oct 19 13:39:34 2010 +0200
+++ b/mercurial/extensions.py	Tue Oct 19 13:43:40 2010 +0200
@@ -46,7 +46,7 @@
     else:
         shortname = name
     if shortname in _extensions:
-        return
+        return _extensions[shortname]
     _extensions[shortname] = None
     if path:
         # the module will be loaded in sys.modules
@@ -66,6 +66,7 @@
             mod = importh(name)
     _extensions[shortname] = mod
     _order.append(shortname)
+    return mod
 
 def loadall(ui):
     result = ui.configitems("extensions")


More information about the Mercurial-devel mailing list