[PATCH] subrepo: use hg.repository instead of creating localrepo directly

Abderrahim Kitouni a.kitouni at gmail.com
Sat Jul 4 09:14:53 CDT 2009


# HG changeset patch
# User Abderrahim Kitouni <a.kitouni at gmail.com>
# Date 1246713495 -3600
# Node ID 8197258310829e4c67cb8fd91ecc322b606be319
# Parent  28b1797b00405f3e238575b4f1b93e23904408ab
subrepo: use hg.repository instead of creating localrepo directly

this way, extensions' reposetup will be called, which allows for git
subrepos to be handled by hg-git (and I believe the same goes for
svn and hgsubversion)

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -8,7 +8,7 @@
 import errno, os
 from i18n import _
 import config, util, node, error
-localrepo = hg = None
+hg = None

 nullstate = ('', '')

@@ -117,9 +117,8 @@ def subrepo(ctx, path):
     # because it wants to make repo objects from deep inside the stack
     # so we manually delay the circular imports to not break
     # scripts that don't use our demand-loading
-    global localrepo, hg
-    import localrepo as l, hg as h
-    localrepo = l
+    global hg
+    import hg as h
     hg = h

     util.path_auditor(ctx._repo.root)(path)
@@ -135,10 +134,10 @@ class hgsubrepo(object):
         r = ctx._repo
         root = r.wjoin(path)
         if os.path.exists(os.path.join(root, '.hg')):
-            self._repo = localrepo.localrepository(r.ui, root)
+            self._repo = hg.repository(r.ui, root)
         else:
             util.makedirs(root)
-            self._repo = localrepo.localrepository(r.ui, root, create=True)
+            self._repo = hg.repository(r.ui, root, create=True)
         self._repo._subparent = r
         self._repo._subsource = state[0]


More information about the Mercurial-devel mailing list