[PATCH] hgwebdir: add support for explicit index files
Yuya Nishihara
yuya at tcha.org
Fri Mar 10 11:56:19 EST 2017
On Mon, 06 Mar 2017 00:35:42 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1488770552 18000
> # Sun Mar 05 22:22:32 2017 -0500
> # Node ID 3ff768dd4fe9faeca8ccba040fa6a085584063aa
> # Parent 023123a67b54d98bd4c8ef8ac8cfd7a96247519e
> hgwebdir: add support for explicit index files
>
> This is useful for when repositories are nested in --web-conf, and in the future
> with hosted subrepositories. The previous behavior was only to render an index
> at each virtual directory. There is now an explicit index.html for each virtual
> directory. Additionally, there is now an explicit index.html for every
> repository directory with a nested repository below it. This seems more
> consistent with each virtual directory hosting an index, and more discoverable
> than to only have an index for a directory that directly hosts a nested
> repository.
I prefer 'index', 'repositories', 'list', etc. than 'index.html' for
consistency with the other method names.
> --- a/mercurial/hgweb/hgwebdir_mod.py
> +++ b/mercurial/hgweb/hgwebdir_mod.py
> @@ -254,34 +254,50 @@
> return []
>
> # top-level index
> - elif not virtual:
> + elif not virtual or virtual == 'index.html':
> + if virtual:
> + req.env['PATH_INFO'] = '/'
Maybe it isn't nice to modify PATH_INFO. Can we pass it as an argument
of makeindex() ?
> + def checkrepos():
> + if not virtual.endswith('/index.html'):
> + return True
> +
> + pdir = virtual[:-len('index.html')]
> + return not any(r.startswith(pdir) for r in repos)
This seems a little confusing. Instead, can we test the virtual path and call
makeindex() directly here?
We might want to show hgweb page if there's a repo named 'index.html'. Other
methods such as '/rev' can be overridden by repository names.
More information about the Mercurial-devel
mailing list