diff --git a/templates/repository/log.html b/templates/repository/log.html
index b74f5af..f6f5add 100644
--- a/templates/repository/log.html
+++ b/templates/repository/log.html
@@ -40,8 +40,10 @@
ID |
Message |
Commit time |
- Files |
- Lines |
+ {% if defaults.LOG_STATS %}
+ Files |
+ Lines |
+ {% endif %}
@@ -72,16 +74,19 @@
{{ commit_time(commit.commit_time, commit.commit_time_offset)|ago }}
|
-
- {% if commit.short_id in diff %}
- {{ diff[commit.short_id].stats.files_changed }}
- {% endif %}
- |
-
- {% if commit.short_id in diff %}
- +{{ diff[commit.short_id].stats.insertions }}/-{{ diff[commit.short_id].stats.deletions }}
- {% endif %}
- |
+
+ {% if defaults.LOG_STATS %}
+
+ {% if commit.short_id in diff %}
+ {{ diff[commit.short_id].stats.files_changed }}
+ {% endif %}
+ |
+
+ {% if commit.short_id in diff %}
+ +{{ diff[commit.short_id].stats.insertions }}/-{{ diff[commit.short_id].stats.deletions }}
+ {% endif %}
+ |
+ {% endif %}
{% endfor %}
diff --git a/web.py b/web.py
index 4b5d942..487dbdf 100644
--- a/web.py
+++ b/web.py
@@ -44,6 +44,10 @@ INSTANCE_DOMAIN = 'domain.local'
# How many commits to show in the log page
LOG_PAGINATION = 100
+# Enable +/- file stats in the log page. Can be disabled for performance, since
+# computing diffstat on many commits for big repos could take too long.
+LOG_STATS = True
+
# Default options for showing diffs in "commit" page
DIFF_VIEW = 'udiff' # "udiff", "udiff_raw" "ssdiff"
DIFF_CONTEXT_LINES = 3
@@ -182,7 +186,8 @@ template = functools.partial(template, template_settings = {
'defaults': {
'DIFF_EXPAND': DIFF_EXPAND,
'DIFF_EXPAND_DIFFSTAT': DIFF_EXPAND_DIFFSTAT,
- 'DIFF_EXPAND_DIFFOPTIONS': DIFF_EXPAND_DIFFOPTIONS
+ 'DIFF_EXPAND_DIFFOPTIONS': DIFF_EXPAND_DIFFOPTIONS,
+ 'LOG_STATS': LOG_STATS
}
},
'autoescape': True
@@ -513,10 +518,11 @@ def log(repository, revision):
commits.append(commit)
# Diff with parent tree, or empty tree if there's no parent
- diff[commit.short_id] = \
- commit.parents[0].tree.diff_to_tree(commit.tree) \
- if len(commit.parents) > 0 \
- else commit.tree.diff_to_tree(swap=True)
+ if LOG_STATS:
+ diff[commit.short_id] = \
+ commit.parents[0].tree.diff_to_tree(commit.tree) \
+ if len(commit.parents) > 0 \
+ else commit.tree.diff_to_tree(swap=True)
return template(
'repository/log.html',