# HG changeset patch # User Matt Mackall # Date 1309381266 18000 # Node ID 4f56b7530eab17014ccdb99f1fe72732f7d9b3a6 # Parent 08ef6b5f37150a72647a48629f827f440f07f339 subrepos: be smarter about what's an absolute path (issue2808) diff -r 08ef6b5f3715 -r 4f56b7530eab mercurial/subrepo.py --- a/mercurial/subrepo.py Wed Jun 29 13:04:00 2011 +0200 +++ b/mercurial/subrepo.py Wed Jun 29 16:01:06 2011 -0500 @@ -198,9 +198,9 @@ or on the top repo config. Abort or return None if no source found.""" if hasattr(repo, '_subparent'): source = util.url(repo._subsource) + if source.isabs(): + return str(source) source.path = posixpath.normpath(source.path) - if posixpath.isabs(source.path) or source.scheme: - return str(source) parent = _abssource(repo._subparent, push, abort=False) if parent: parent = util.url(parent) diff -r 08ef6b5f3715 -r 4f56b7530eab mercurial/util.py --- a/mercurial/util.py Wed Jun 29 13:04:00 2011 +0200 +++ b/mercurial/util.py Wed Jun 29 16:01:06 2011 -0500 @@ -1555,6 +1555,17 @@ return (s, (None, (str(self), self.host), self.user, self.passwd or '')) + def isabs(self): + if self.scheme and self.scheme != 'file': + return True # remote URL + if hasdriveletter(self.path): + return True # absolute for our purposes - can't be joined() + if self.path.startswith(r'\\'): + return True # Windows UNC path + if self.path.startswith('/'): + return True # POSIX-style + return False + def localpath(self): if self.scheme == 'file' or self.scheme == 'bundle': path = self.path or '/'