Mercurial > public > mercurial-scm > hg
comparison mercurial/extensions.py @ 4818:616a5adbf402
extensions: untangle some recursive dependencies
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 05 Jul 2007 15:37:23 -0500 |
parents | 63b9d2deed48 |
children | af0995261f02 |
comparison
equal
deleted
inserted
replaced
4817:0ac6b537893f | 4818:616a5adbf402 |
---|---|
4 # | 4 # |
5 # This software may be used and distributed according to the terms | 5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. | 6 # of the GNU General Public License, incorporated herein by reference. |
7 | 7 |
8 import imp, os | 8 import imp, os |
9 import commands, hg, util, sys | 9 import util, sys |
10 from i18n import _ | 10 from i18n import _ |
11 | 11 |
12 _extensions = {} | 12 _extensions = {} |
13 commandtable = {} | |
14 setuphooks = [] | |
13 | 15 |
14 def find(name): | 16 def find(name): |
15 '''return module with given extension name''' | 17 '''return module with given extension name''' |
16 try: | 18 try: |
17 return _extensions[name] | 19 return _extensions[name] |
52 uisetup = getattr(mod, 'uisetup', None) | 54 uisetup = getattr(mod, 'uisetup', None) |
53 if uisetup: | 55 if uisetup: |
54 uisetup(ui) | 56 uisetup(ui) |
55 reposetup = getattr(mod, 'reposetup', None) | 57 reposetup = getattr(mod, 'reposetup', None) |
56 if reposetup: | 58 if reposetup: |
57 hg.repo_setup_hooks.append(reposetup) | 59 setuphooks.append(reposetup) |
58 cmdtable = getattr(mod, 'cmdtable', {}) | 60 cmdtable = getattr(mod, 'cmdtable', {}) |
59 overrides = [cmd for cmd in cmdtable if cmd in commands.table] | 61 overrides = [cmd for cmd in cmdtable if cmd in commandtable] |
60 if overrides: | 62 if overrides: |
61 ui.warn(_("extension '%s' overrides commands: %s\n") | 63 ui.warn(_("extension '%s' overrides commands: %s\n") |
62 % (name, " ".join(overrides))) | 64 % (name, " ".join(overrides))) |
63 commands.table.update(cmdtable) | 65 commandtable.update(cmdtable) |
64 | 66 |
65 def loadall(ui): | 67 def loadall(ui): |
66 result = ui.configitems("extensions") | 68 result = ui.configitems("extensions") |
67 for i, (name, path) in enumerate(result): | 69 for i, (name, path) in enumerate(result): |
68 if path: | 70 if path: |