diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py index 4790732559ade2c1ab13608ba8d9e0c22d335b9b_bWVyY3VyaWFsL3N1YnJlcG8ucHk=..69d4c8c5c25ebdfbf6d1514dd0efb1ae2fa30355_bWVyY3VyaWFsL3N1YnJlcG8ucHk= 100644 --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -622,7 +622,11 @@ return True self._repo._subsource = source srcurl = _abssource(self._repo) - other = hg.peer(self._repo, {}, srcurl) + + # Defer creating the peer until after the status message is logged, in + # case there are network problems. + getpeer = lambda: hg.peer(self._repo, {}, srcurl) + if len(self._repo) == 0: # use self._repo.vfs instead of self.wvfs to remove .hg only self._repo.vfs.rmtree() @@ -636,7 +640,7 @@ self.ui.status(_('sharing subrepo %s from %s\n') % (subrelpath(self), srcurl)) shared = hg.share(self._repo._subparent.baseui, - other, self._repo.root, + getpeer(), self._repo.root, update=False, bookmarks=False) self._repo = shared.local() else: @@ -657,7 +661,7 @@ self.ui.status(_('cloning subrepo %s from %s\n') % (subrelpath(self), util.hidepassword(srcurl))) other, cloned = hg.clone(self._repo._subparent.baseui, {}, - other, self._repo.root, + getpeer(), self._repo.root, update=False, shareopts=shareopts) self._repo = cloned.local() self._initrepo(parentrepo, source, create=True) @@ -666,7 +670,7 @@ self.ui.status(_('pulling subrepo %s from %s\n') % (subrelpath(self), util.hidepassword(srcurl))) cleansub = self.storeclean(srcurl) - exchange.pull(self._repo, other) + exchange.pull(self._repo, getpeer()) if cleansub: # keep the repo clean after pull self._cachestorehash(srcurl) diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t index 4790732559ade2c1ab13608ba8d9e0c22d335b9b_dGVzdHMvdGVzdC1odHRwLWJ1bmRsZTEudA==..69d4c8c5c25ebdfbf6d1514dd0efb1ae2fa30355_dGVzdHMvdGVzdC1odHRwLWJ1bmRsZTEudA== 100644 --- a/tests/test-http-bundle1.t +++ b/tests/test-http-bundle1.t @@ -340,6 +340,7 @@ added 3 changesets with 7 changes to 7 files new changesets 8b6053c928fe:56f9bc90cce6 updating to branch default + cloning subrepo sub from http://localhost:$HGPORT/sub abort: HTTP Error 404: Not Found [255] $ hg clone http://localhost:$HGPORT/ slash-clone @@ -350,6 +351,7 @@ added 3 changesets with 7 changes to 7 files new changesets 8b6053c928fe:56f9bc90cce6 updating to branch default + cloning subrepo sub from http://localhost:$HGPORT/sub abort: HTTP Error 404: Not Found [255] diff --git a/tests/test-http.t b/tests/test-http.t index 4790732559ade2c1ab13608ba8d9e0c22d335b9b_dGVzdHMvdGVzdC1odHRwLnQ=..69d4c8c5c25ebdfbf6d1514dd0efb1ae2fa30355_dGVzdHMvdGVzdC1odHRwLnQ= 100644 --- a/tests/test-http.t +++ b/tests/test-http.t @@ -417,6 +417,7 @@ added 3 changesets with 7 changes to 7 files new changesets 8b6053c928fe:56f9bc90cce6 updating to branch default + cloning subrepo sub from http://localhost:$HGPORT/sub abort: HTTP Error 404: Not Found [255] $ hg clone http://localhost:$HGPORT/ slash-clone @@ -427,6 +428,7 @@ added 3 changesets with 7 changes to 7 files new changesets 8b6053c928fe:56f9bc90cce6 updating to branch default + cloning subrepo sub from http://localhost:$HGPORT/sub abort: HTTP Error 404: Not Found [255] diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t index 4790732559ade2c1ab13608ba8d9e0c22d335b9b_dGVzdHMvdGVzdC1zdWJyZXBvLWRlZXAtbmVzdGVkLWNoYW5nZS50..69d4c8c5c25ebdfbf6d1514dd0efb1ae2fa30355_dGVzdHMvdGVzdC1zdWJyZXBvLWRlZXAtbmVzdGVkLWNoYW5nZS50 100644 --- a/tests/test-subrepo-deep-nested-change.t +++ b/tests/test-subrepo-deep-nested-change.t @@ -108,6 +108,7 @@ added 1 changesets with 3 changes to 3 files new changesets 7f491f53a367 updating to branch default + cloning subrepo sub1 from http://localhost:$HGPORT/../sub1 abort: HTTP Error 404: Not Found [255] diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t index 4790732559ade2c1ab13608ba8d9e0c22d335b9b_dGVzdHMvdGVzdC1zdWJyZXBvLXJlY3Vyc2lvbi50..69d4c8c5c25ebdfbf6d1514dd0efb1ae2fa30355_dGVzdHMvdGVzdC1zdWJyZXBvLXJlY3Vyc2lvbi50 100644 --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -567,8 +567,9 @@ $ hg --config extensions.share= --config progress.disable=True \ > share ../empty2 ../empty_share updating working directory + sharing subrepo foo from $TESTTMP/empty2/foo abort: repository $TESTTMP/empty2/foo not found! [255] $ hg --config progress.disable=True clone ../empty2 ../empty_clone updating to branch default @@ -570,8 +571,9 @@ abort: repository $TESTTMP/empty2/foo not found! [255] $ hg --config progress.disable=True clone ../empty2 ../empty_clone updating to branch default + cloning subrepo foo from $TESTTMP/empty2/foo abort: repository $TESTTMP/empty2/foo not found! [255] diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t index 4790732559ade2c1ab13608ba8d9e0c22d335b9b_dGVzdHMvdGVzdC1zdWJyZXBvLnQ=..69d4c8c5c25ebdfbf6d1514dd0efb1ae2fa30355_dGVzdHMvdGVzdC1zdWJyZXBvLnQ= 100644 --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -1889,6 +1889,7 @@ $ cd .. $ hg clone malicious-proxycommand malicious-proxycommand-clone updating to branch default + cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") [255] @@ -1901,6 +1902,7 @@ $ rm -r malicious-proxycommand-clone $ hg clone malicious-proxycommand malicious-proxycommand-clone updating to branch default + cloning subrepo s from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s") [255] @@ -1913,6 +1915,7 @@ $ rm -r malicious-proxycommand-clone $ hg clone malicious-proxycommand malicious-proxycommand-clone updating to branch default + cloning subrepo s from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path abort: no suitable response from remote hg! [255] $ [ ! -f owned ] || echo 'you got owned' @@ -1926,6 +1929,7 @@ $ rm -r malicious-proxycommand-clone $ hg clone malicious-proxycommand malicious-proxycommand-clone updating to branch default + cloning subrepo s from ssh://fakehost%7Ctouch%20owned/path abort: no suitable response from remote hg! [255] $ [ ! -f owned ] || echo 'you got owned' @@ -1938,6 +1942,7 @@ $ rm -r malicious-proxycommand-clone $ hg clone malicious-proxycommand malicious-proxycommand-clone updating to branch default + cloning subrepo s from ssh://-oProxyCommand%3Dtouch%20owned@example.com/path abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s") [255]