changeset 4850:7031d9e2fa45

hgweb: browse subdirectories before checking whether parent directory is also a repository
author Brendan Cully <brendan@kublai.com>
date Sat, 07 Jul 2007 15:09:08 -0700
parents 5e365008360f
children 9a45e1597d08
files mercurial/hgweb/hgwebdir_mod.py
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Jul 06 10:29:09 2007 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sat Jul 07 15:09:08 2007 -0700
@@ -220,8 +220,15 @@
                 req.write(staticfile(static, fname, req) or
                           tmpl('error', error='%r not found' % fname))
             elif virtual:
+                repos = dict(self.repos)
+                # browse subdirectories
+                subdir = virtual + '/'
+                if [r for r in repos if r.startswith(subdir)]:
+                    makeindex(req, subdir)
+                    return
+
                 while virtual:
-                    real = dict(self.repos).get(virtual)
+                    real = repos.get(virtual)
                     if real:
                         break
                     up = virtual.rfind('/')
@@ -238,11 +245,7 @@
                     except hg.RepoError, inst:
                         req.write(tmpl("error", error=str(inst)))
                 else:
-                    subdir=req.env.get("PATH_INFO", "").strip('/') + '/'
-                    if [r for r in self.repos if r[0].startswith(subdir)]:
-                        makeindex(req, subdir)
-                    else:
-                        req.write(tmpl("notfound", repo=virtual))
+                    req.write(tmpl("notfound", repo=virtual))
             else:
                 if req.form.has_key('static'):
                     static = os.path.join(templater.templatepath(), "static")