diff -r 0c14b3f23294 -r eed02e192770 mercurial/subrepo.py --- a/mercurial/subrepo.py Wed Feb 28 00:29:27 2018 -0500 +++ b/mercurial/subrepo.py Thu Mar 01 11:13:00 2018 -0500 @@ -982,7 +982,13 @@ if len(self._repo) == 0: # use self._repo.vfs instead of self.wvfs to remove .hg only self._repo.vfs.rmtree() - if parentrepo.shared(): + + # A remote subrepo could be shared if there is a local copy + # relative to the parent's share source. But clone pooling doesn't + # assemble the repos in a tree, so that can't be consistently done. + # A simpler option is for the user to configure clone pooling, and + # work with that. + if parentrepo.shared() and hg.islocal(srcurl): self.ui.status(_('sharing subrepo %s from %s\n') % (subrelpath(self), srcurl)) shared = hg.share(self._repo._subparent.baseui,