home » zplus/clif.git
Author zPlus <zplus@peers.community> 2022-08-12 09:57:08
Committer zPlus <zplus@peers.community> 2022-08-12 09:57:08
Commit b517ecb (patch)
Tree 6493621
Parent(s)

Add option for disabling diffstat on log page.


commits diff: f8b00f1..b517ecb
2 files changed, 28 insertions, 17 deletionsdownload


Diffstat
-rw-r--r-- templates/repository/log.html 29
-rw-r--r-- web.py 16

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+17/-12 M   templates/repository/log.html
index b74f5af..f6f5add
old size: 4K - new size: 4K
@@ -40,8 +40,10 @@
40 40 <td class="id">ID</td>
41 41 <td class="message">Message</td>
42 42 <td class="time">Commit time</td>
43 - <td class="files">Files</td>
44 - <td class="lines">Lines</td>
43 + {% if defaults.LOG_STATS %}
44 + <td class="files">Files</td>
45 + <td class="lines">Lines</td>
46 + {% endif %}
45 47 </tr>
46 48 </thead>
47 49
@@ -72,16 +74,19 @@
72 74 <td class="time" title="{{ commit_time(commit.commit_time, commit.commit_time_offset) }}">
73 75 {{ commit_time(commit.commit_time, commit.commit_time_offset)|ago }}
74 76 </td>
75 - <td class="files">
76 - {% if commit.short_id in diff %}
77 - {{ diff[commit.short_id].stats.files_changed }}
78 - {% endif %}
79 - </td>
80 - <td class="lines">
81 - {% if commit.short_id in diff %}
82 - <span class="insertions">+{{ diff[commit.short_id].stats.insertions }}</span>/<span class="deletions">-{{ diff[commit.short_id].stats.deletions }}</span>
83 - {% endif %}
84 - </td>
77 +
78 + {% if defaults.LOG_STATS %}
79 + <td class="files">
80 + {% if commit.short_id in diff %}
81 + {{ diff[commit.short_id].stats.files_changed }}
82 + {% endif %}
83 + </td>
84 + <td class="lines">
85 + {% if commit.short_id in diff %}
86 + <span class="insertions">+{{ diff[commit.short_id].stats.insertions }}</span>/<span class="deletions">-{{ diff[commit.short_id].stats.deletions }}</span>
87 + {% endif %}
88 + </td>
89 + {% endif %}
85 90 </tr>
86 91 {% endfor %}
87 92 </tbody>

+11/-5 M   web.py
index 4b5d942..487dbdf
old size: 29K - new size: 29K
@@ -44,6 +44,10 @@ INSTANCE_DOMAIN = 'domain.local'
44 44 # How many commits to show in the log page
45 45 LOG_PAGINATION = 100
46 46
47 + # Enable +/- file stats in the log page. Can be disabled for performance, since
48 + # computing diffstat on many commits for big repos could take too long.
49 + LOG_STATS = True
50 +
47 51 # Default options for showing diffs in "commit" page
48 52 DIFF_VIEW = 'udiff' # "udiff", "udiff_raw" "ssdiff"
49 53 DIFF_CONTEXT_LINES = 3
@@ -182,7 +186,8 @@ template = functools.partial(template, template_settings = {
182 186 'defaults': {
183 187 'DIFF_EXPAND': DIFF_EXPAND,
184 188 'DIFF_EXPAND_DIFFSTAT': DIFF_EXPAND_DIFFSTAT,
185 - 'DIFF_EXPAND_DIFFOPTIONS': DIFF_EXPAND_DIFFOPTIONS
189 + 'DIFF_EXPAND_DIFFOPTIONS': DIFF_EXPAND_DIFFOPTIONS,
190 + 'LOG_STATS': LOG_STATS
186 191 }
187 192 },
188 193 'autoescape': True
@@ -513,10 +518,11 @@ def log(repository, revision):
513 518 commits.append(commit)
514 519
515 520 # Diff with parent tree, or empty tree if there's no parent
516 - diff[commit.short_id] = \
517 - commit.parents[0].tree.diff_to_tree(commit.tree) \
518 - if len(commit.parents) > 0 \
519 - else commit.tree.diff_to_tree(swap=True)
521 + if LOG_STATS:
522 + diff[commit.short_id] = \
523 + commit.parents[0].tree.diff_to_tree(commit.tree) \
524 + if len(commit.parents) > 0 \
525 + else commit.tree.diff_to_tree(swap=True)
520 526
521 527 return template(
522 528 'repository/log.html',