diff mercurial/subrepo.py @ 35834:fb278041df06 stable

subrepo: activate clone pooling to enable sharing with remote URLs This is the easiest way to ensure that repositories with remote subrepo references can share the subrepos, consistent with how local subrepos can be shared.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 01 Mar 2018 11:37:00 -0500
parents eed02e192770
children b529e640015d
line wrap: on
line diff
--- a/mercurial/subrepo.py	Thu Mar 01 11:13:00 2018 -0500
+++ b/mercurial/subrepo.py	Thu Mar 01 11:37:00 2018 -0500
@@ -996,11 +996,25 @@
                                   update=False, bookmarks=False)
                 self._repo = shared.local()
             else:
+                # TODO: find a common place for this and this code in the
+                # share.py wrap of the clone command.
+                if parentrepo.shared():
+                    pool = self.ui.config('share', 'pool')
+                    if pool:
+                        pool = util.expandpath(pool)
+
+                    shareopts = {
+                        'pool': pool,
+                        'mode': self.ui.config('share', 'poolnaming'),
+                    }
+                else:
+                    shareopts = {}
+
                 self.ui.status(_('cloning subrepo %s from %s\n')
                                % (subrelpath(self), srcurl))
                 other, cloned = hg.clone(self._repo._subparent.baseui, {},
                                          other, self._repo.root,
-                                         update=False)
+                                         update=False, shareopts=shareopts)
                 self._repo = cloned.local()
             self._initrepo(parentrepo, source, create=True)
             self._cachestorehash(srcurl)