Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 4845:4f86c58c6c56
hgwebdir: do not walk up the given path looking for a repository. It is there or it isn't.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Fri, 06 Jul 2007 09:15:17 -0700 |
parents | 496ac05c6a31 |
children | 40007fe82be9 |
comparison
equal
deleted
inserted
replaced
4844:13cb25bb7607 | 4845:4f86c58c6c56 |
---|---|
218 static = os.path.join(templater.templatepath(), 'static') | 218 static = os.path.join(templater.templatepath(), 'static') |
219 fname = virtual[7:] | 219 fname = virtual[7:] |
220 req.write(staticfile(static, fname, req) or | 220 req.write(staticfile(static, fname, req) or |
221 tmpl('error', error='%r not found' % fname)) | 221 tmpl('error', error='%r not found' % fname)) |
222 elif virtual: | 222 elif virtual: |
223 while virtual: | 223 if virtual in dict(self.repos): |
224 real = dict(self.repos).get(virtual) | |
225 if real: | |
226 break | |
227 up = virtual.rfind('/') | |
228 if up < 0: | |
229 break | |
230 virtual = virtual[:up] | |
231 if real: | |
232 req.env['REPO_NAME'] = virtual | 224 req.env['REPO_NAME'] = virtual |
233 try: | 225 try: |
234 repo = hg.repository(parentui, real) | 226 repo = hg.repository(parentui, real) |
235 hgweb(repo).run_wsgi(req) | 227 hgweb(repo).run_wsgi(req) |
236 except IOError, inst: | 228 except IOError, inst: |
237 req.write(tmpl("error", error=inst.strerror)) | 229 req.write(tmpl("error", error=inst.strerror)) |
238 except hg.RepoError, inst: | 230 except hg.RepoError, inst: |
239 req.write(tmpl("error", error=str(inst))) | 231 req.write(tmpl("error", error=str(inst))) |
240 else: | 232 else: |
241 subdir=req.env.get("PATH_INFO", "").strip('/') + '/' | 233 subdir=virtual + '/' |
242 if [r for r in self.repos if r[0].startswith(subdir)]: | 234 if [r for r in self.repos if r[0].startswith(subdir)]: |
243 makeindex(req, subdir) | 235 makeindex(req, subdir) |
244 else: | 236 else: |
245 req.write(tmpl("notfound", repo=virtual)) | 237 req.write(tmpl("notfound", repo=virtual)) |
246 else: | 238 else: |