##// END OF EJS Templates
subrepos: use url.url when normalizing repo paths...
Brodie Rao -
r13771:ce622730 default
parent child Browse files
Show More
@@ -5,10 +5,10 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
8 import errno, os, re, xml.dom.minidom, shutil, posixpath
9 import stat, subprocess, tarfile
9 import stat, subprocess, tarfile
10 from i18n import _
10 from i18n import _
11 import config, util, node, error, cmdutil, bookmarks
11 import config, util, node, error, cmdutil, url, bookmarks
12 hg = None
12 hg = None
13
13
14 nullstate = ('', '', 'empty')
14 nullstate = ('', '', 'empty')
@@ -193,21 +193,16 b' def _abssource(repo, push=False, abort=T'
193 """return pull/push path of repo - either based on parent repo .hgsub info
193 """return pull/push path of repo - either based on parent repo .hgsub info
194 or on the top repo config. Abort or return None if no source found."""
194 or on the top repo config. Abort or return None if no source found."""
195 if hasattr(repo, '_subparent'):
195 if hasattr(repo, '_subparent'):
196 source = repo._subsource
196 source = url.url(repo._subsource)
197 if source.startswith('/') or '://' in source:
197 source.path = posixpath.normpath(source.path)
198 return source
198 if posixpath.isabs(source.path) or source.scheme:
199 return str(source)
199 parent = _abssource(repo._subparent, push, abort=False)
200 parent = _abssource(repo._subparent, push, abort=False)
200 if parent:
201 if parent:
201 if '://' in parent:
202 parent = url.url(parent)
202 if parent[-1] == '/':
203 parent.path = posixpath.join(parent.path, source.path)
203 parent = parent[:-1]
204 parent.path = posixpath.normpath(parent.path)
204 r = urlparse.urlparse(parent + '/' + source)
205 return str(parent)
205 r = urlparse.urlunparse((r[0], r[1],
206 posixpath.normpath(r[2]),
207 r[3], r[4], r[5]))
208 return r
209 else: # plain file system path
210 return posixpath.normpath(os.path.join(parent, repo._subsource))
211 else: # recursion reached top repo
206 else: # recursion reached top repo
212 if hasattr(repo, '_subtoppath'):
207 if hasattr(repo, '_subtoppath'):
213 return repo._subtoppath
208 return repo._subtoppath
General Comments 0
You need to be logged in to leave comments. Login now