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 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 |
223 while virtual: |
230 while virtual: |
224 real = dict(self.repos).get(virtual) |
231 real = repos.get(virtual) |
225 if real: |
232 if real: |
226 break |
233 break |
227 up = virtual.rfind('/') |
234 up = virtual.rfind('/') |
228 if up < 0: |
235 if up < 0: |
229 break |
236 break |
236 except IOError, inst: |
243 except IOError, inst: |
237 req.write(tmpl("error", error=inst.strerror)) |
244 req.write(tmpl("error", error=inst.strerror)) |
238 except hg.RepoError, inst: |
245 except hg.RepoError, inst: |
239 req.write(tmpl("error", error=str(inst))) |
246 req.write(tmpl("error", error=str(inst))) |
240 else: |
247 else: |
241 subdir=req.env.get("PATH_INFO", "").strip('/') + '/' |
248 req.write(tmpl("notfound", repo=virtual)) |
242 if [r for r in self.repos if r[0].startswith(subdir)]: |
|
243 makeindex(req, subdir) |
|
244 else: |
|
245 req.write(tmpl("notfound", repo=virtual)) |
|
246 else: |
249 else: |
247 if req.form.has_key('static'): |
250 if req.form.has_key('static'): |
248 static = os.path.join(templater.templatepath(), "static") |
251 static = os.path.join(templater.templatepath(), "static") |
249 fname = req.form['static'][0] |
252 fname = req.form['static'][0] |
250 req.write(staticfile(static, fname, req) |
253 req.write(staticfile(static, fname, req) |