Show More
@@ -7147,3 +7147,12 def version_(ui): | |||
|
7147 | 7147 | for i, name in enumerate(names): |
|
7148 | 7148 | ui.write(" %-*s %s %s\n" % |
|
7149 | 7149 | (maxnamelen, name, place[i], vers[i])) |
|
7150 | ||
|
7151 | def loadcmdtable(ui, name, cmdtable): | |
|
7152 | """Load command functions from specified cmdtable | |
|
7153 | """ | |
|
7154 | overrides = [cmd for cmd in cmdtable if cmd in table] | |
|
7155 | if overrides: | |
|
7156 | ui.warn(_("extension '%s' overrides commands: %s\n") | |
|
7157 | % (name, " ".join(overrides))) | |
|
7158 | table.update(cmdtable) |
@@ -743,6 +743,17 def _checkshellalias(lui, ui, args, prec | |||
|
743 | 743 | [], {}) |
|
744 | 744 | |
|
745 | 745 | _loaded = set() |
|
746 | ||
|
747 | # list of (objname, loadermod, loadername) tuple: | |
|
748 | # - objname is the name of an object in extension module, from which | |
|
749 | # extra information is loaded | |
|
750 | # - loadermod is the module where loader is placed | |
|
751 | # - loadername is the name of the function, which takes (ui, extensionname, | |
|
752 | # extraobj) arguments | |
|
753 | extraloaders = [ | |
|
754 | ('cmdtable', commands, 'loadcmdtable'), | |
|
755 | ] | |
|
756 | ||
|
746 | 757 | def _dispatch(req): |
|
747 | 758 | args = req.args |
|
748 | 759 | ui = req.ui |
@@ -772,12 +783,10 def _dispatch(req): | |||
|
772 | 783 | # (uisetup and extsetup are handled in extensions.loadall) |
|
773 | 784 | |
|
774 | 785 | for name, module in exts: |
|
775 | cmdtable = getattr(module, 'cmdtable', {}) | |
|
776 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] | |
|
777 | if overrides: | |
|
778 | ui.warn(_("extension '%s' overrides commands: %s\n") | |
|
779 | % (name, " ".join(overrides))) | |
|
780 | commands.table.update(cmdtable) | |
|
786 | for objname, loadermod, loadername in extraloaders: | |
|
787 | extraobj = getattr(module, objname, None) | |
|
788 | if extraobj is not None: | |
|
789 | getattr(loadermod, loadername)(ui, name, extraobj) | |
|
781 | 790 | _loaded.add(name) |
|
782 | 791 | |
|
783 | 792 | # (reposetup is handled in hg.repository) |
General Comments 0
You need to be logged in to leave comments.
Login now