Mercurial > hg
changeset 4570:78c50632437e
Merge with crew
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Wed, 13 Jun 2007 13:50:29 -0700 |
parents | 622d8ed78b47 (diff) 9b3a818adae6 (current diff) |
children | eb403f295ff1 b1716a8b32d3 |
files | |
diffstat | 3 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/extensions.py Wed Jun 13 15:02:09 2007 +0300 +++ b/mercurial/extensions.py Wed Jun 13 13:50:29 2007 -0700 @@ -5,7 +5,8 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -import imp, commands, hg, util, sys +import imp, os +import commands, hg, util, sys from i18n import _ _extensions = {} @@ -28,7 +29,12 @@ # choose an unique name so that it doesn't # conflicts with other modules module_name = "hgext_%s" % name.replace('.', '_') - mod = imp.load_source(module_name, path) + if os.path.isdir(path): + # module/__init__.py style + fd, fpath, desc = imp.find_module('', [path]) + mod = imp.load_module(module_name, fd, fpath, desc) + else: + mod = imp.load_source(module_name, path) else: def importh(name): mod = __import__(name)
--- a/tests/test-extension Wed Jun 13 15:02:09 2007 +0300 +++ b/tests/test-extension Wed Jun 13 13:50:29 2007 -0700 @@ -29,6 +29,10 @@ EOF abspath=`pwd`/foobar.py +mkdir barfoo +cp foobar.py barfoo/__init__.py +barfoopath=`pwd`/barfoo + hg init a cd a echo foo > file @@ -43,3 +47,9 @@ hg clone a b hg bar + +echo '% module/__init__.py-style' +echo '[extensions]' > $HGRCPATH +echo "barfoo = $barfoopath" >> $HGRCPATH +cd a +hg foo