--- a/tests/test-subrepo.t Tue Oct 19 03:55:28 2010 +0200
+++ b/tests/test-subrepo.t Tue Oct 19 03:56:20 2010 +0200
@@ -585,3 +585,64 @@
$ hg -R repo update
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ rm -rf repo2 repo
+
+
+Issue1852 subrepos with relative paths always push/pull relative to default
+
+Prepare a repo with subrepo
+
+ $ hg init issue1852a
+ $ cd issue1852a
+ $ hg init sub/repo
+ $ echo test > sub/repo/foo
+ $ hg -R sub/repo add sub/repo/foo
+ $ echo sub/repo = sub/repo > .hgsub
+ $ hg add .hgsub
+ $ hg ci -mtest
+ committing subrepository sub/repo
+ $ echo test >> sub/repo/foo
+ $ hg ci -mtest
+ committing subrepository sub/repo
+ $ cd ..
+
+Create repo without default path, pull top repo, and see what happens on update
+
+ $ hg init issue1852b
+ $ hg -R issue1852b pull issue1852a
+ pulling from issue1852a
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 3 changes to 2 files
+ (run 'hg update' to get a working copy)
+ $ hg -R issue1852b update
+ abort: default path for subrepository sub/repo not found
+ [255]
+
+Pull -u now doesn't help
+
+ $ hg -R issue1852b pull -u issue1852a
+ pulling from issue1852a
+ searching for changes
+ no changes found
+
+Try the same, but with pull -u
+
+ $ hg init issue1852c
+ $ hg -R issue1852c pull -r0 -u issue1852a
+ pulling from issue1852a
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 2 changes to 2 files
+ abort: default path for subrepository sub/repo not found
+ [255]
+
+Try to push from the other side
+
+ $ hg -R issue1852a push issue1852c
+ pushing to issue1852c
+ abort: default path for subrepository sub/repo not found
+ [255]