diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3545,6 +3545,7 @@ def dispatch(args): 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/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -48,9 +48,14 @@ def islocal(repo): return False return repo.local() +repo_setup_hooks = [] + def repository(ui, path=None, create=False): """return a repository object for the specified path""" - return _lookup(path).instance(ui, path, create) + repo = _lookup(path).instance(ui, path, create) + for hook in repo_setup_hooks: + hook(ui, repo) + return repo def defaultdest(source): '''return default destination of clone if none is given'''