##// END OF EJS Templates
hgwebdir: check for repo foo before browsing subdirectories of foo/
Brendan Cully -
r4852:edd07be9 default
parent child Browse files
Show More
@@ -221,31 +221,31 b' class hgwebdir(object):'
221 tmpl('error', error='%r not found' % fname))
221 tmpl('error', error='%r not found' % fname))
222 elif virtual:
222 elif virtual:
223 repos = dict(self.repos)
223 repos = dict(self.repos)
224 # browse subdirectories
225 subdir = virtual + '/'
226 if [r for r in repos if r.startswith(subdir)]:
227 makeindex(req, subdir)
228 return
229
230 while virtual:
224 while virtual:
231 real = repos.get(virtual)
225 real = repos.get(virtual)
232 if real:
226 if real:
233 break
227 req.env['REPO_NAME'] = virtual
228 try:
229 repo = hg.repository(parentui, real)
230 hgweb(repo).run_wsgi(req)
231 except IOError, inst:
232 req.write(tmpl("error", error=inst.strerror))
233 except hg.RepoError, inst:
234 req.write(tmpl("error", error=str(inst)))
235 return
236
237 # browse subdirectories
238 subdir = virtual + '/'
239 if [r for r in repos if r.startswith(subdir)]:
240 makeindex(req, subdir)
241 return
242
234 up = virtual.rfind('/')
243 up = virtual.rfind('/')
235 if up < 0:
244 if up < 0:
236 break
245 break
237 virtual = virtual[:up]
246 virtual = virtual[:up]
238 if real:
247
239 req.env['REPO_NAME'] = virtual
248 req.write(tmpl("notfound", repo=virtual))
240 try:
241 repo = hg.repository(parentui, real)
242 hgweb(repo).run_wsgi(req)
243 except IOError, inst:
244 req.write(tmpl("error", error=inst.strerror))
245 except hg.RepoError, inst:
246 req.write(tmpl("error", error=str(inst)))
247 else:
248 req.write(tmpl("notfound", repo=virtual))
249 else:
249 else:
250 if req.form.has_key('static'):
250 if req.form.has_key('static'):
251 static = os.path.join(templater.templatepath(), "static")
251 static = os.path.join(templater.templatepath(), "static")
General Comments 0
You need to be logged in to leave comments. Login now