subrepo: respect non-default path for incoming/outgoing stable
authorMartin Geisler <mg@aragost.com>
Wed, 18 May 2011 15:13:26 +0200
branchstable
changeset 14360 ab687820c4cc
parent 14356 02a5bebd0dc4
child 14361 ea7081645987
child 14379 bd23d5f28bbb
child 14470 34f502851ff8
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.
mercurial/commands.py
tests/test-subrepo.t
--- 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
--- 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: