Mercurial > hg
changeset 4818:616a5adbf402
extensions: untangle some recursive dependencies
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 05 Jul 2007 15:37:23 -0500 |
parents | 0ac6b537893f |
children | f48290864625 |
files | mercurial/commands.py mercurial/extensions.py mercurial/hg.py |
diffstat | 3 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Jul 03 00:13:52 2007 +0900 +++ b/mercurial/commands.py Thu Jul 05 15:37:23 2007 -0500 @@ -3109,6 +3109,8 @@ "version": (version_, [], _('hg version')), } +extensions.commandtable = table + norepo = ("clone init version help debugancestor debugcomplete debugdata" " debugindex debugindexdot debugdate debuginstall") optionalrepo = ("paths serve showconfig")
--- a/mercurial/extensions.py Tue Jul 03 00:13:52 2007 +0900 +++ b/mercurial/extensions.py Thu Jul 05 15:37:23 2007 -0500 @@ -6,10 +6,12 @@ # of the GNU General Public License, incorporated herein by reference. import imp, os -import commands, hg, util, sys +import util, sys from i18n import _ _extensions = {} +commandtable = {} +setuphooks = [] def find(name): '''return module with given extension name''' @@ -54,13 +56,13 @@ uisetup(ui) reposetup = getattr(mod, 'reposetup', None) if reposetup: - hg.repo_setup_hooks.append(reposetup) + setuphooks.append(reposetup) cmdtable = getattr(mod, 'cmdtable', {}) - overrides = [cmd for cmd in cmdtable if cmd in commands.table] + overrides = [cmd for cmd in cmdtable if cmd in commandtable] if overrides: ui.warn(_("extension '%s' overrides commands: %s\n") % (name, " ".join(overrides))) - commands.table.update(cmdtable) + commandtable.update(cmdtable) def loadall(ui): result = ui.configitems("extensions")
--- a/mercurial/hg.py Tue Jul 03 00:13:52 2007 +0900 +++ b/mercurial/hg.py Thu Jul 05 15:37:23 2007 -0500 @@ -10,7 +10,7 @@ from repo import * from i18n import _ import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo -import errno, lock, os, shutil, util, cmdutil +import errno, lock, os, shutil, util, cmdutil, extensions import merge as _merge import verify as _verify @@ -50,13 +50,11 @@ return False return repo.local() -repo_setup_hooks = [] - def repository(ui, path='', create=False): """return a repository object for the specified path""" repo = _lookup(path).instance(ui, path, create) ui = getattr(repo, "ui", ui) - for hook in repo_setup_hooks: + for hook in extensions.setuphooks: hook(ui, repo) return repo