Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 40655:69d4c8c5c25e stable
subrepo: print the status line before creating the peer for better diagnostics
I ran into a problem where I tried updating to a different branch, and the
process appeared to hang. It turned out that the subrepo revision wasn't
available locally, and I must have originally cloned it from an `hg serve -S` on
a machine that currently wasn't serving anything. It took 2+ minutes to
timeout, and didn't mention what it was connecting to even then.
There are a couple of other issues in this scenario too.
- The repo is dirty after the failed checkout because the top level repo is
updated first. We should probably make 2 passes- top down to pull
everything needed, and then do an update once everything is in place.
- Something must be reading .hgsubstate from wdir because if the same merge
command is run after the timeout, a prompt is issued that the local and
remote subrepo diverged, instead of hanging. But it lists the local version
and remote version as having the same hash.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 16 Nov 2018 18:37:26 -0500 |
parents | 6f152067ba57 |
children | 9199548525fc |
comparison
equal
deleted
inserted
replaced
40637:4790732559ad | 40655:69d4c8c5c25e |
---|---|
620 # Allow shared subrepos tracked at null to setup the sharedpath | 620 # Allow shared subrepos tracked at null to setup the sharedpath |
621 if len(self._repo) != 0 or not parentrepo.shared(): | 621 if len(self._repo) != 0 or not parentrepo.shared(): |
622 return True | 622 return True |
623 self._repo._subsource = source | 623 self._repo._subsource = source |
624 srcurl = _abssource(self._repo) | 624 srcurl = _abssource(self._repo) |
625 other = hg.peer(self._repo, {}, srcurl) | 625 |
626 # Defer creating the peer until after the status message is logged, in | |
627 # case there are network problems. | |
628 getpeer = lambda: hg.peer(self._repo, {}, srcurl) | |
629 | |
626 if len(self._repo) == 0: | 630 if len(self._repo) == 0: |
627 # use self._repo.vfs instead of self.wvfs to remove .hg only | 631 # use self._repo.vfs instead of self.wvfs to remove .hg only |
628 self._repo.vfs.rmtree() | 632 self._repo.vfs.rmtree() |
629 | 633 |
630 # A remote subrepo could be shared if there is a local copy | 634 # A remote subrepo could be shared if there is a local copy |
634 # work with that. | 638 # work with that. |
635 if parentrepo.shared() and hg.islocal(srcurl): | 639 if parentrepo.shared() and hg.islocal(srcurl): |
636 self.ui.status(_('sharing subrepo %s from %s\n') | 640 self.ui.status(_('sharing subrepo %s from %s\n') |
637 % (subrelpath(self), srcurl)) | 641 % (subrelpath(self), srcurl)) |
638 shared = hg.share(self._repo._subparent.baseui, | 642 shared = hg.share(self._repo._subparent.baseui, |
639 other, self._repo.root, | 643 getpeer(), self._repo.root, |
640 update=False, bookmarks=False) | 644 update=False, bookmarks=False) |
641 self._repo = shared.local() | 645 self._repo = shared.local() |
642 else: | 646 else: |
643 # TODO: find a common place for this and this code in the | 647 # TODO: find a common place for this and this code in the |
644 # share.py wrap of the clone command. | 648 # share.py wrap of the clone command. |
655 shareopts = {} | 659 shareopts = {} |
656 | 660 |
657 self.ui.status(_('cloning subrepo %s from %s\n') | 661 self.ui.status(_('cloning subrepo %s from %s\n') |
658 % (subrelpath(self), util.hidepassword(srcurl))) | 662 % (subrelpath(self), util.hidepassword(srcurl))) |
659 other, cloned = hg.clone(self._repo._subparent.baseui, {}, | 663 other, cloned = hg.clone(self._repo._subparent.baseui, {}, |
660 other, self._repo.root, | 664 getpeer(), self._repo.root, |
661 update=False, shareopts=shareopts) | 665 update=False, shareopts=shareopts) |
662 self._repo = cloned.local() | 666 self._repo = cloned.local() |
663 self._initrepo(parentrepo, source, create=True) | 667 self._initrepo(parentrepo, source, create=True) |
664 self._cachestorehash(srcurl) | 668 self._cachestorehash(srcurl) |
665 else: | 669 else: |
666 self.ui.status(_('pulling subrepo %s from %s\n') | 670 self.ui.status(_('pulling subrepo %s from %s\n') |
667 % (subrelpath(self), util.hidepassword(srcurl))) | 671 % (subrelpath(self), util.hidepassword(srcurl))) |
668 cleansub = self.storeclean(srcurl) | 672 cleansub = self.storeclean(srcurl) |
669 exchange.pull(self._repo, other) | 673 exchange.pull(self._repo, getpeer()) |
670 if cleansub: | 674 if cleansub: |
671 # keep the repo clean after pull | 675 # keep the repo clean after pull |
672 self._cachestorehash(srcurl) | 676 self._cachestorehash(srcurl) |
673 return False | 677 return False |
674 | 678 |