diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3106,6 +3106,9 @@ def load_extensions(ui): uisetup = getattr(mod, 'uisetup', None) if uisetup: uisetup(ui) + reposetup = getattr(mod, 'reposetup', None) + if reposetup: + hg.repo_setup_hooks.append(reposetup) cmdtable = getattr(mod, 'cmdtable', {}) for t in cmdtable: if t in table: @@ -3188,11 +3191,6 @@ def dispatch(args): if not repo: repo = hg.repository(u, path=path) u = repo.ui - for name in external.itervalues(): - mod = sys.modules[name] - if hasattr(mod, 'reposetup'): - mod.reposetup(u, repo) - hg.repo_setup_hooks.append(mod.reposetup) except hg.RepoError: if cmd not in optionalrepo.split(): raise