diff mercurial/hg.py @ 5192:60acf1432ee0

Move cmdtable and reposetup handling out of extensions.py A new function (extensions.extensions) allows the code that is interested in those attributes to handle them directly. This allows some cleanups of extensions.py. Notably, we can remove the extensions.commandtable hack. It also makes it easier to add standard extension attributes, like a "hgwebsetup" function or a "helptable" dict that augments the data in help.py, etc.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 17 Aug 2007 17:33:27 -0300
parents c1dbc9ae8f2b
children 5517aa5aafb0
line wrap: on
line diff
--- a/mercurial/hg.py	Fri Aug 17 19:11:16 2007 +0200
+++ b/mercurial/hg.py	Fri Aug 17 17:33:27 2007 -0300
@@ -61,8 +61,10 @@
     """return a repository object for the specified path"""
     repo = _lookup(path).instance(ui, path, create)
     ui = getattr(repo, "ui", ui)
-    for hook in extensions.setuphooks:
-        hook(ui, repo)
+    for name, module in extensions.extensions():
+        hook = getattr(module, 'reposetup', None)
+        if hook:
+            hook(ui, repo)
     return repo
 
 def defaultdest(source):