changeset 15055:d629f1e89021 stable 1.9.2

subrepo: fix cloning of repos from urls without slash after host (issue2970) This fixes a regression introduced with the new url handling in 1.9. This should perhaps be fixed in the url class instead, but that might be too invasive for a stable bugfix.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 26 Aug 2011 16:23:35 +0200
parents 17ffb30d9174
children 97b936d2ac68
files mercurial/subrepo.py tests/test-http.t
diffstat 2 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Thu Aug 25 22:06:03 2011 +0300
+++ b/mercurial/subrepo.py	Fri Aug 26 16:23:35 2011 +0200
@@ -204,7 +204,7 @@
         parent = _abssource(repo._subparent, push, abort=False)
         if parent:
             parent = util.url(parent)
-            parent.path = posixpath.join(parent.path, source.path)
+            parent.path = posixpath.join(parent.path or '', source.path)
             parent.path = posixpath.normpath(parent.path)
             return str(parent)
     else: # recursion reached top repo
--- a/tests/test-http.t	Thu Aug 25 22:06:03 2011 +0300
+++ b/tests/test-http.t	Fri Aug 26 16:23:35 2011 +0200
@@ -159,6 +159,32 @@
 
   $ cd ..
 
+clone of serve with repo in root and unserved subrepo (issue2970)
+
+  $ hg --cwd test init sub
+  $ hg --cwd test/sub tag something
+  $ echo sub = sub > test/.hgsub
+  $ hg --cwd test add .hgsub
+  $ hg --cwd test commit -qm 'add subrepo'
+  $ hg clone http://localhost:$HGPORT noslash-clone
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 7 changes to 7 files
+  updating to branch default
+  abort: HTTP Error 404: Not Found
+  [255]
+  $ hg clone http://localhost:$HGPORT/ slash-clone
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 7 changes to 7 files
+  updating to branch default
+  abort: HTTP Error 404: Not Found
+  [255]
+
 check error log
 
   $ cat error.log