Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/extensions.py @ 5031:af0995261f02
extensions: don't get confused by aliasing between "foo" and "hgext.foo"
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 30 Jul 2007 14:53:03 -0700 |
parents | 616a5adbf402 |
children | 3edd6fedc33a |
comparison
equal
deleted
inserted
replaced
5030:c89671c3b062 | 5031:af0995261f02 |
---|---|
22 if k.endswith('.' + name) or k.endswith('/' + name): | 22 if k.endswith('.' + name) or k.endswith('/' + name): |
23 return v | 23 return v |
24 raise KeyError(name) | 24 raise KeyError(name) |
25 | 25 |
26 def load(ui, name, path): | 26 def load(ui, name, path): |
27 if name in _extensions: | 27 if name.startswith('hgext.'): |
28 shortname = name[6:] | |
29 else: | |
30 shortname = name | |
31 if shortname in _extensions: | |
28 return | 32 return |
29 if path: | 33 if path: |
30 # the module will be loaded in sys.modules | 34 # the module will be loaded in sys.modules |
31 # choose an unique name so that it doesn't | 35 # choose an unique name so that it doesn't |
32 # conflicts with other modules | 36 # conflicts with other modules |
47 return mod | 51 return mod |
48 try: | 52 try: |
49 mod = importh("hgext.%s" % name) | 53 mod = importh("hgext.%s" % name) |
50 except ImportError: | 54 except ImportError: |
51 mod = importh(name) | 55 mod = importh(name) |
52 _extensions[name] = mod | 56 _extensions[shortname] = mod |
53 | 57 |
54 uisetup = getattr(mod, 'uisetup', None) | 58 uisetup = getattr(mod, 'uisetup', None) |
55 if uisetup: | 59 if uisetup: |
56 uisetup(ui) | 60 uisetup(ui) |
57 reposetup = getattr(mod, 'reposetup', None) | 61 reposetup = getattr(mod, 'reposetup', None) |