619 srcurl = _abssource(self._repo) |
619 srcurl = _abssource(self._repo) |
620 other = hg.peer(self._repo, {}, srcurl) |
620 other = hg.peer(self._repo, {}, srcurl) |
621 if len(self._repo) == 0: |
621 if len(self._repo) == 0: |
622 # use self._repo.vfs instead of self.wvfs to remove .hg only |
622 # use self._repo.vfs instead of self.wvfs to remove .hg only |
623 self._repo.vfs.rmtree() |
623 self._repo.vfs.rmtree() |
624 if parentrepo.shared(): |
624 |
|
625 # A remote subrepo could be shared if there is a local copy |
|
626 # relative to the parent's share source. But clone pooling doesn't |
|
627 # assemble the repos in a tree, so that can't be consistently done. |
|
628 # A simpler option is for the user to configure clone pooling, and |
|
629 # work with that. |
|
630 if parentrepo.shared() and hg.islocal(srcurl): |
625 self.ui.status(_('sharing subrepo %s from %s\n') |
631 self.ui.status(_('sharing subrepo %s from %s\n') |
626 % (subrelpath(self), srcurl)) |
632 % (subrelpath(self), srcurl)) |
627 shared = hg.share(self._repo._subparent.baseui, |
633 shared = hg.share(self._repo._subparent.baseui, |
628 other, self._repo.root, |
634 other, self._repo.root, |
629 update=False, bookmarks=False) |
635 update=False, bookmarks=False) |
630 self._repo = shared.local() |
636 self._repo = shared.local() |
631 else: |
637 else: |
|
638 # TODO: find a common place for this and this code in the |
|
639 # share.py wrap of the clone command. |
|
640 if parentrepo.shared(): |
|
641 pool = self.ui.config('share', 'pool') |
|
642 if pool: |
|
643 pool = util.expandpath(pool) |
|
644 |
|
645 shareopts = { |
|
646 'pool': pool, |
|
647 'mode': self.ui.config('share', 'poolnaming'), |
|
648 } |
|
649 else: |
|
650 shareopts = {} |
|
651 |
632 self.ui.status(_('cloning subrepo %s from %s\n') |
652 self.ui.status(_('cloning subrepo %s from %s\n') |
633 % (subrelpath(self), srcurl)) |
653 % (subrelpath(self), srcurl)) |
634 other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
654 other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
635 other, self._repo.root, |
655 other, self._repo.root, |
636 update=False) |
656 update=False, shareopts=shareopts) |
637 self._repo = cloned.local() |
657 self._repo = cloned.local() |
638 self._initrepo(parentrepo, source, create=True) |
658 self._initrepo(parentrepo, source, create=True) |
639 self._cachestorehash(srcurl) |
659 self._cachestorehash(srcurl) |
640 else: |
660 else: |
641 self.ui.status(_('pulling subrepo %s from %s\n') |
661 self.ui.status(_('pulling subrepo %s from %s\n') |