Add deep recursion option to multidir configuration
Tue Dec 20 16:30:22 UTC 2005 nils@ndecker.de
* Add deep recursion option to multidir configuration
diff -rN -u old-darcsweb/config.py.sample new-darcsweb/config.py.sample
--- old-darcsweb/config.py.sample 2015-04-15 14:39:11.000000000 +0000
+++ new-darcsweb/config.py.sample 2015-04-15 14:39:12.000000000 +0000
@@ -93,9 +93,14 @@
# The name is taken from the directory, and inside the variables the string
# "%(name)s" gets expanded to the it.
#
+# If you set multidir_deep to True then all subdirectories are searched
+# for darcs repositories. Subdirectories starting with a dot (.) are not
+# searched. This may be slow, if huge directory trees must be searched.
+#
class multi1:
multidir = '/usr/local/src'
+ multidir_deep = False
repodesc = 'Repository for %(name)s'
repourl = 'http://auriga.wearlab.de/~alb/repos/%(name)s'
repoencoding = 'latin1'
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2015-04-15 14:39:11.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2015-04-15 14:39:12.000000000 +0000
@@ -1970,7 +1970,17 @@
if 'exclude' not in dir(c):
c.exclude = []
- entries = os.listdir(c.multidir)
+
+ entries = []
+ if 'multidir_deep' in dir(c) and c.multidir_deep:
+ for (root, dirs, files) in os.walk(c.multidir):
+ # do not visit hidden directories
+ dirs[:] = [d for d in dirs if not d.startswith('.')]
+ if '_darcs' in dirs:
+ entries.append(root[1+len(c.multidir):])
+ else:
+ entries = os.listdir(c.multidir)
+
entries.sort()
for name in entries:
if name.startswith('.'):