# HG changeset patch # User Martin Geisler # Date 1305724406 -7200 # Node ID ab687820c4cc81d7551c08e2692820838cb2a984 # Parent 02a5bebd0dc48ab51ef8f921c71f5871e6045fe7 subrepo: respect non-default path for incoming/outgoing Push and pull set repo._subtoppath before pushing or pulling subrepos. The incoming and outgoing commands needed to do the same. diff -r 02a5bebd0dc4 -r ab687820c4cc mercurial/commands.py --- a/mercurial/commands.py Wed May 18 09:31:19 2011 +0200 +++ b/mercurial/commands.py Wed May 18 15:13:26 2011 +0200 @@ -2516,8 +2516,13 @@ ui.status(_('comparing with %s\n') % url.hidepassword(source)) return bookmarks.diff(ui, repo, other) - ret = hg.incoming(ui, repo, source, opts) - return ret + repo._subtoppath = ui.expandpath(source) + try: + ret = hg.incoming(ui, repo, source, opts) + return ret + finally: + del repo._subtoppath + def init(ui, dest=".", **opts): """create a new repository in the given directory @@ -2803,8 +2808,12 @@ ui.status(_('comparing with %s\n') % url.hidepassword(dest)) return bookmarks.diff(ui, other, repo) - ret = hg.outgoing(ui, repo, dest, opts) - return ret + repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') + try: + ret = hg.outgoing(ui, repo, dest, opts) + return ret + finally: + del repo._subtoppath def parents(ui, repo, file_=None, **opts): """show the parents of the working directory or revision diff -r 02a5bebd0dc4 -r ab687820c4cc tests/test-subrepo.t --- a/tests/test-subrepo.t Wed May 18 09:31:19 2011 +0200 +++ b/tests/test-subrepo.t Wed May 18 15:13:26 2011 +0200 @@ -660,6 +660,26 @@ adding file changes added 1 changesets with 1 changes to 1 files +Incoming and outgoing should not use the default path: + + $ hg clone -q issue1852a issue1852d + $ hg -R issue1852d outgoing --subrepos issue1852c + comparing with issue1852c + searching for changes + no changes found + comparing with issue1852c/sub/repo + searching for changes + no changes found + [1] + $ hg -R issue1852d incoming --subrepos issue1852c + comparing with issue1852c + searching for changes + no changes found + comparing with issue1852c/sub/repo + searching for changes + no changes found + [1] + Check status of files when none of them belong to the first subrepository: