Add autodesc and autoexclude options.
Fri Dec 30 23:44:19 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Add autodesc and autoexclude options.
This patch implements two optional options for multidir repos: autodesc and
autoexclude.
If autodesc is enabled, the description will be taken from the file named
"_darcs/third_party/darcsweb/desc", inside the repository. If it doesn't
exist, the default will be used.
If autoexclude is enabled, only repositories with a directory named
"_darcs/third_party/darcsweb/" will be listed.
The path "_darcs/third_party/darcsweb/" for darcsweb-exclusive preferences was
chosen following a suggestion by David Roundy in the mail with Subject
"[darcs-users] darcsweb 0.12 and some questions", Message-ID
20051109123238.GB17288@abridgegame.org, date "9 Nov 2005 07:32:44".
diff -rN -u old-darcsweb/config.py.sample new-darcsweb/config.py.sample
--- old-darcsweb/config.py.sample 2013-07-27 15:55:31.000000000 +0000
+++ new-darcsweb/config.py.sample 2013-07-27 15:55:31.000000000 +0000
@@ -111,4 +111,14 @@
# they're relative to multidir, not absolute)
#exclude = 'dir1', 'dir2'
+ # if you want the descriptions to be picked up automatically from the
+ # file named "_darcs/third_party/darcsweb/desc" (one line only), set
+ # this to True. It defaults to False
+ #autodesc = True
+
+ # if you want to exclude all the repositories which do NOT have a
+ # directory named "_darcs/third_party/darcsweb/" inside, set this to
+ # True. It defaults to False.
+ #autoexclude = True
+
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2013-07-27 15:55:31.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-07-27 15:55:31.000000000 +0000
@@ -2013,8 +2013,23 @@
if name in c.exclude:
continue
+ if 'autoexclude' in dir(c) and c.autoexclude:
+ dpath = fulldir + \
+ '/_darcs/third_party/darcsweb'
+ if not os.path.isdir(dpath):
+ continue
+
+ if 'autodesc' in dir(c) and c.autodesc:
+ dpath = fulldir + \
+ '/_darcs/third_party/darcsweb/desc'
+ if os.access(dpath, os.R_OK):
+ desc = open(dpath).read()
+ else:
+ desc = c.repodesc % { 'name': name }
+ else:
+ desc = c.repodesc % { 'name': name }
+
rdir = fulldir
- desc = c.repodesc % { 'name': name }
url = c.repourl % { 'name': name }
class tmp_config:
reponame = name