[diffoscope] 02/02: Bump up default value for max_diff_block_lines

Ximin Luo infinity0 at debian.org
Thu Aug 25 01:14:28 CEST 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch better-lazy-loading
in repository diffoscope.

commit 671b78b3d6e249237d9771bf096f7e8668d2fd4b
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 e4c7442..13a4a25 100644
--- a/diffoscope/presenters/html.py
+++ b/diffoscope/presenters/html.py
@@ -213,7 +213,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
@@ -697,6 +697,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 < 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