diff --git a/mercurial/commands.py b/mercurial/commands.py
index 02a5bebd0dc48ab51ef8f921c71f5871e6045fe7_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..ab687820c4cc81d7551c08e2692820838cb2a984_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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 --git a/tests/test-subrepo.t b/tests/test-subrepo.t
index 02a5bebd0dc48ab51ef8f921c71f5871e6045fe7_dGVzdHMvdGVzdC1zdWJyZXBvLnQ=..ab687820c4cc81d7551c08e2692820838cb2a984_dGVzdHMvdGVzdC1zdWJyZXBvLnQ= 100644
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -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: