# HG changeset patch # User Alexis S. L. Carvalho # Date 1170783781 7200 # Node ID 5d9ede002453ec8ac3aa4fb1bce01e7a6783e27d # Parent 96863fc3036ab15fb04747781fab83577a4bc7db install reposetup hook right after loading the extension 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 diff --git a/tests/test-extension b/tests/test-extension new file mode 100755 --- /dev/null +++ b/tests/test-extension @@ -0,0 +1,42 @@ +#!/bin/sh +# Test basic extension support + +cat > foobar.py < file +hg add file +hg commit -m 'add file' + +echo '[extensions]' >> $HGRCPATH +echo "foobar = $abspath" >> $HGRCPATH +hg foo + +cd .. +hg clone a b + +hg bar diff --git a/tests/test-extension.out b/tests/test-extension.out new file mode 100644 --- /dev/null +++ b/tests/test-extension.out @@ -0,0 +1,9 @@ +uisetup called +reposetup called for a +Foo +uisetup called +reposetup called for a +reposetup called for b +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +uisetup called +Bar