Fri Jul 1 04:36:53 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Add a configuration generator.
diff -rN -u old-darcsweb/config.py.sample new-darcsweb/config.py.sample
--- old-darcsweb/config.py.sample 2015-04-15 14:35:41.000000000 +0000
+++ new-darcsweb/config.py.sample 2015-04-15 14:35:41.000000000 +0000
@@ -22,6 +22,10 @@
# There are no restrictions on the class' name, except that it can't be named
# "base" (because it's the name of the one avobe).
#
+# If you have a lot of repos and/or you're too lazy to do this by hand, you
+# can use the configuration generator that comes with darcsweb, called
+# "mkconfig.py".
+#
class repo1:
# the descriptive name
diff -rN -u old-darcsweb/mkconfig.py new-darcsweb/mkconfig.py
--- old-darcsweb/mkconfig.py 1970-01-01 00:00:00.000000000 +0000
+++ new-darcsweb/mkconfig.py 2015-04-15 14:35:41.000000000 +0000
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+"""
+A darcsweb configuration generator
+----------------------------------
+
+This is a small utility that generates configuration files for darcsweb, in
+case you're lazy and/or have many repositories.
+
+It receives four parameters: the base URL for your repositories, the base
+description, the encoding and the directory to get the repositories from.
+It replaces the string "NAME" with the name of the directory that holds the
+repository, so you can specify urls and descriptions with the name in them.
+
+Then, it generates an appropiate configuration for each repository in the
+directory. It outputs the configuration to stdout, so you can redirect it to
+config.py. For example:
+
+$ mkconf.py "http://example.com/darcs/NAME" "Repo for NAME" latin1 \\
+ ~/devel/repos/ >> config.py
+
+Remember that you still need to do the base configuration by hand. You can do
+that by copying the sample included with darcsweb.
+"""
+
+
+import sys
+import os
+
+
+def help():
+ print "Error: wrong parameter count"
+ print __doc__
+
+
+# check parameters
+if len(sys.argv) != 5:
+ help()
+ sys.exit(0)
+
+myself, baseurl, basedesc, baseencoding, basepath = sys.argv
+
+dirs = os.listdir(basepath)
+for d in dirs:
+ path = basepath + '/' + d
+ if not os.path.isdir(path + '/_darcs'):
+ # not a repo, skip
+ continue
+ s = \
+"""
+class %(name)s:
+ reponame = '%(name)s'
+ repodesc = '%(desc)s'
+ repodir = '%(dir)s'
+ repourl = '%(url)s'
+ repoencoding = '%(encoding)s'
+""" % {
+ 'name': d,
+ 'desc': basedesc.replace('NAME', d),
+ 'dir': os.path.abspath(basepath + '/' + d),
+ 'url': baseurl.replace('NAME', d),
+ 'encoding': baseencoding,
+ }
+ print s
+