comparison mercurial/localrepo.py @ 15735:5b384b7f48d5

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 26 Dec 2011 18:08:20 -0600
parents ebaefd8c6028 417127af3996
children 57241845a4bb
comparison
equal deleted inserted replaced
15734:9b0efacd7745 15735:5b384b7f48d5
126 def _checknested(self, path): 126 def _checknested(self, path):
127 """Determine if path is a legal nested repository.""" 127 """Determine if path is a legal nested repository."""
128 if not path.startswith(self.root): 128 if not path.startswith(self.root):
129 return False 129 return False
130 subpath = path[len(self.root) + 1:] 130 subpath = path[len(self.root) + 1:]
131 normsubpath = util.pconvert(subpath)
131 132
132 # XXX: Checking against the current working copy is wrong in 133 # XXX: Checking against the current working copy is wrong in
133 # the sense that it can reject things like 134 # the sense that it can reject things like
134 # 135 #
135 # $ hg cat -r 10 sub/x.txt 136 # $ hg cat -r 10 sub/x.txt
147 # since we want to prevent access to nested repositories on 148 # since we want to prevent access to nested repositories on
148 # the filesystem *now*. 149 # the filesystem *now*.
149 ctx = self[None] 150 ctx = self[None]
150 parts = util.splitpath(subpath) 151 parts = util.splitpath(subpath)
151 while parts: 152 while parts:
152 prefix = os.sep.join(parts) 153 prefix = '/'.join(parts)
153 if prefix in ctx.substate: 154 if prefix in ctx.substate:
154 if prefix == subpath: 155 if prefix == normsubpath:
155 return True 156 return True
156 else: 157 else:
157 sub = ctx.sub(prefix) 158 sub = ctx.sub(prefix)
158 return sub.checknested(subpath[len(prefix) + 1:]) 159 return sub.checknested(subpath[len(prefix) + 1:])
159 else: 160 else: