Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/hgwebdir_mod.py @ 7450:79d1bb737c16
hgweb: extend [paths] syntax to match repositories recursively (issue852)
This feature somehow duplicates [collections] but it is simpler to use and has
less issues under Windows where using absolute path as configuration file key
is not supported.
Suggested by Dirkjan Ochtman <dirkjan@ochtman.nl>
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 01 Dec 2008 14:20:20 +0100 |
parents | 526c40a74bd0 |
children | e60aaae83323 |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Mon Dec 01 13:44:34 2008 +0100 +++ b/mercurial/hgweb/hgwebdir_mod.py Mon Dec 01 14:20:20 2008 +0100 @@ -51,7 +51,21 @@ if cp.has_option('web', 'baseurl'): self._baseurl = cp.get('web', 'baseurl') if cp.has_section('paths'): - self.repos.extend(cleannames(cp.items('paths'))) + paths = cleannames(cp.items('paths')) + for prefix, root in paths: + roothead, roottail = os.path.split(root) + if roottail != '*': + self.repos.append((prefix, root)) + continue + # "foo = /bar/*" makes every subrepo of /bar/ to be + # mounted as foo/subrepo + roothead = os.path.normpath(roothead) + for path in util.walkrepos(roothead, followsym=True): + path = os.path.normpath(path) + name = util.pconvert(path[len(roothead):]).strip('/') + if prefix: + name = prefix + '/' + name + self.repos.append((name, path)) if cp.has_section('collections'): for prefix, root in cp.items('collections'): for path in util.walkrepos(root, followsym=True):