new optional config varuable: disable_annotate
Fri Mar 16 19:27:14 UTC 2007 VMiklos <vmiklos@frugalware.org>
* new optional config varuable: disable_annotate
* the annotate feature is still enabled by default
* this can be useful on slow machines
diff -rN -u old-darcsweb/config.py.sample new-darcsweb/config.py.sample
--- old-darcsweb/config.py.sample 2013-07-18 20:17:56.000000000 +0000
+++ new-darcsweb/config.py.sample 2013-07-18 20:17:56.000000000 +0000
@@ -79,6 +79,11 @@
# here. Example for CIA:
#author_links = "http://cia.navi.cx/stats/author/%(author)s"
+ # If you want to disable the annotate feature (for performance reasons,
+ # the http connection will time out on slow machines), uncomment this
+ # option.
+ #disable_annotate = True
+
#
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2013-07-18 20:17:56.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-07-18 20:17:56.000000000 +0000
@@ -1036,7 +1036,10 @@
if hash:
cmd += ' --match="hash %s"' % hash
cmd += ' "%s"' % fname
- out = run_darcs(cmd)
+ if not config.disable_annotate:
+ out = run_darcs(cmd)
+ else:
+ return None
return parse_annotate(out)
@@ -1851,6 +1854,13 @@
def do_annotate(fname, phash, style):
print_header()
ann = get_annotate(fname, phash)
+ if not ann:
+ print """
+<i>The annotate feature has been disabled</i>
+</div>
+ """
+ print_footer()
+ return
print_navbar(f = fname, h = ann.lastchange_hash)
print """
@@ -2371,6 +2381,10 @@
config.author_links = base.author_links
else:
config.author_links = None
+ if "disable_annotate" in dir(base):
+ config.disable_annotate = base.disable_annotate
+ else:
+ config.disable_annotate = False