diff 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
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Mon Dec 15 12:02:18 2008 -0800
+++ b/mercurial/hgweb/hgwebdir_mod.py	Thu Dec 18 22:32:48 2008 +0100
@@ -54,13 +54,18 @@
                 paths = cleannames(cp.items('paths'))
                 for prefix, root in paths:
                     roothead, roottail = os.path.split(root)
-                    if roottail != '*':
+                    # "foo = /bar/*" makes every subrepo of /bar/ to be
+                    # mounted as foo/subrepo
+                    # and "foo = /bar/**" does even recurse inside the
+                    # subdirectories, remember to use it without working dir.
+                    try:
+                        recurse = {'*': False, '**': True}[roottail]
+                    except KeyError:
                         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):
+                    for path in util.walkrepos(roothead, followsym=True,
+                                               recurse=recurse):
                         path = os.path.normpath(path)
                         name = util.pconvert(path[len(roothead):]).strip('/')
                         if prefix: