# HG changeset patch # User Brendan Cully # Date 2006-10-05 00:04:40 # Node ID 1e322b44b366de5ef45e1a6f903721d7d0819b35 # Parent 329ac0c0c0e8a731bbff15419cc8eeabbfaff3a9 Teach hgwebdir about new interface diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -85,9 +85,10 @@ class hgwebdir(object): def archivelist(ui, nodeid, url): allowed = ui.configlist("web", "allow_archive") - for i in ['zip', 'gz', 'bz2']: - if i in allowed or ui.configbool("web", "allow" + i): - yield {"type" : i, "node": nodeid, "url": url} + for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: + if i[0] in allowed or ui.configbool("web", "allow" + i[0]): + yield {"type" : i[0], "extension": i[1], + "node": nodeid, "url": url} def entries(sortcolumn="", descending=False, **map): rows = [] @@ -101,7 +102,7 @@ class hgwebdir(object): get = u.config url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name]) - .replace("//", "/")) + .replace("//", "/")) + '/' # update time with local timezone try: @@ -143,8 +144,16 @@ class hgwebdir(object): virtual = req.env.get("PATH_INFO", "").strip('/') if virtual: - real = dict(self.repos).get(virtual) + while virtual: + real = dict(self.repos).get(virtual) + if real: + break + up = virtual.rfind('/') + if up < 0: + break + virtual = virtual[:up] if real: + req.env['REPO_NAME'] = virtual try: hgweb(real).run_wsgi(req) except IOError, inst: