[diffoscope] 03/05: Bump up default value for max_diff_block_lines
Chris Lamb
chris at chris-lamb.co.uk
Mon Jan 9 17:31:23 CET 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch better-lazy-loading
in repository diffoscope.
commit 215bab3995b7a27556419265ea46406d94df1154
Author: Ximin Luo <infinity0 at debian.org>
Date: Thu Aug 25 01:13:38 2016 +0200
Bump up default value for max_diff_block_lines
Also warn when max_diff_block_lines is low compared to separate_file_diff_size
---
diffoscope/config.py | 2 +-
diffoscope/presenters/html.py | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/diffoscope/config.py b/diffoscope/config.py
index ab56752..97a1182 100644
--- a/diffoscope/config.py
+++ b/diffoscope/config.py
@@ -28,7 +28,7 @@ class classproperty(property):
class Config(object):
def __init__(self):
# 0 to disable max
- self._max_diff_block_lines = 512
+ self._max_diff_block_lines = 8192
self._max_diff_input_lines = 2 ** 20 # GNU diff cannot process arbitrary large files :(
self._max_report_size = 2000 * 2 ** 10 # 2000 kB
self._separate_file_diff_size = 200 * 2 ** 10 # 200kB
diff --git a/diffoscope/presenters/html.py b/diffoscope/presenters/html.py
index 0e887b6..3450d20 100644
--- a/diffoscope/presenters/html.py
+++ b/diffoscope/presenters/html.py
@@ -219,7 +219,7 @@ def create_limited_print_func(print_func, max_page_size):
def estimate_num_rows_per_page(separate_file_diff_size):
# each row takes about 1200 bytes in the output, so roughly calculate
# the number of rows that 4 * separate_file_diff_size will hold
- return separate_file_diff_size * 4 // 1200
+ return separate_file_diff_size * 4 // 1024
buf, add_cpt, del_cpt = [], 0, 0
@@ -716,6 +716,14 @@ def output_html_directory(directory, difference, css_url=None, jquery_url=None):
if jquery_url == 'disable':
jquery_url = None
+ if Config.general.separate_file_diff_size:
+ num_rows = estimate_num_rows_per_page(Config.general.separate_file_diff_size)
+ if Config.general.max_diff_block_lines and Config.general.max_diff_block_lines < num_rows:
+ logger.info('You selected a very low --max-diff-block-lines=%s; it\'s '+
+ 'unlikely that --separate-file-diff-size=%s will have any effect.',
+ Config.general.max_diff_block_lines,
+ Config.general.separate_file_diff_size)
+
with file_printer(directory, "index.html") as print_func:
print_func = create_limited_print_func(print_func, Config.general.max_report_size)
try:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list