comparison mercurial/hgweb/hgwebdir_mod.py @ 7523:e60aaae83323

hgweb: recurse down collections only if ** in [paths] collections: direct child repos only paths *: direct child repos only (like collections) paths **: recursive discovery When ** is used, the mq repository (if any) is also shown.
author Benoit Allard <benoit@aeteurope.nl>
date Thu, 18 Dec 2008 22:32:48 +0100
parents 79d1bb737c16
children 305efd897a63
comparison
equal deleted inserted replaced
7522:2f4a399a8787 7523:e60aaae83323
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 paths = cleannames(cp.items('paths')) 54 paths = cleannames(cp.items('paths'))
55 for prefix, root in paths: 55 for prefix, root in paths:
56 roothead, roottail = os.path.split(root) 56 roothead, roottail = os.path.split(root)
57 if roottail != '*': 57 # "foo = /bar/*" makes every subrepo of /bar/ to be
58 # mounted as foo/subrepo
59 # and "foo = /bar/**" does even recurse inside the
60 # subdirectories, remember to use it without working dir.
61 try:
62 recurse = {'*': False, '**': True}[roottail]
63 except KeyError:
58 self.repos.append((prefix, root)) 64 self.repos.append((prefix, root))
59 continue 65 continue
60 # "foo = /bar/*" makes every subrepo of /bar/ to be
61 # mounted as foo/subrepo
62 roothead = os.path.normpath(roothead) 66 roothead = os.path.normpath(roothead)
63 for path in util.walkrepos(roothead, followsym=True): 67 for path in util.walkrepos(roothead, followsym=True,
68 recurse=recurse):
64 path = os.path.normpath(path) 69 path = os.path.normpath(path)
65 name = util.pconvert(path[len(roothead):]).strip('/') 70 name = util.pconvert(path[len(roothead):]).strip('/')
66 if prefix: 71 if prefix:
67 name = prefix + '/' + name 72 name = prefix + '/' + name
68 self.repos.append((name, path)) 73 self.repos.append((name, path))