# HG changeset patch # User Matt Mackall # Date 1183667843 18000 # Node ID 616a5adbf40262d90bab8036ab639588d8aecd0e # Parent 0ac6b537893fea3028453254894bad4494cab2f7 extensions: untangle some recursive dependencies diff -r 0ac6b537893f -r 616a5adbf402 mercurial/commands.py --- 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") diff -r 0ac6b537893f -r 616a5adbf402 mercurial/extensions.py --- 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") diff -r 0ac6b537893f -r 616a5adbf402 mercurial/hg.py --- 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