Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
7449:f848d7f96195 | 7450:79d1bb737c16 |
---|---|
49 if cp.has_option('web', 'stripes'): | 49 if cp.has_option('web', 'stripes'): |
50 self.stripecount = int(cp.get('web', 'stripes')) | 50 self.stripecount = int(cp.get('web', 'stripes')) |
51 if cp.has_option('web', 'baseurl'): | 51 if cp.has_option('web', 'baseurl'): |
52 self._baseurl = cp.get('web', 'baseurl') | 52 self._baseurl = cp.get('web', 'baseurl') |
53 if cp.has_section('paths'): | 53 if cp.has_section('paths'): |
54 self.repos.extend(cleannames(cp.items('paths'))) | 54 paths = cleannames(cp.items('paths')) |
55 for prefix, root in paths: | |
56 roothead, roottail = os.path.split(root) | |
57 if roottail != '*': | |
58 self.repos.append((prefix, root)) | |
59 continue | |
60 # "foo = /bar/*" makes every subrepo of /bar/ to be | |
61 # mounted as foo/subrepo | |
62 roothead = os.path.normpath(roothead) | |
63 for path in util.walkrepos(roothead, followsym=True): | |
64 path = os.path.normpath(path) | |
65 name = util.pconvert(path[len(roothead):]).strip('/') | |
66 if prefix: | |
67 name = prefix + '/' + name | |
68 self.repos.append((name, path)) | |
55 if cp.has_section('collections'): | 69 if cp.has_section('collections'): |
56 for prefix, root in cp.items('collections'): | 70 for prefix, root in cp.items('collections'): |
57 for path in util.walkrepos(root, followsym=True): | 71 for path in util.walkrepos(root, followsym=True): |
58 repo = os.path.normpath(path) | 72 repo = os.path.normpath(path) |
59 name = repo | 73 name = repo |