##// 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,21 +221,9 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
234 up = virtual.rfind('/')
235 if up < 0:
236 break
237 virtual = virtual[:up]
238 if real:
239 req.env['REPO_NAME'] = virtual
227 req.env['REPO_NAME'] = virtual
240 try:
228 try:
241 repo = hg.repository(parentui, real)
229 repo = hg.repository(parentui, real)
@@ -244,7 +232,19 b' class hgwebdir(object):'
244 req.write(tmpl("error", error=inst.strerror))
232 req.write(tmpl("error", error=inst.strerror))
245 except hg.RepoError, inst:
233 except hg.RepoError, inst:
246 req.write(tmpl("error", error=str(inst)))
234 req.write(tmpl("error", error=str(inst)))
247 else:
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
243 up = virtual.rfind('/')
244 if up < 0:
245 break
246 virtual = virtual[:up]
247
248 req.write(tmpl("notfound", repo=virtual))
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'):
General Comments 0
You need to be logged in to leave comments. Login now