[diffoscope] 01/02: Split --report-size into --max-text-report-size - the defaults for each are not really compatible and --text should emit everything by default.

Chris Lamb chris at chris-lamb.co.uk
Tue Feb 7 23:40:38 UTC 2017


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

lamby pushed a commit to branch master
in repository diffoscope.

commit 83ebe3cb6d5127bbb17093b145114c65292e7030
Author: Chris Lamb <lamby at debian.org>
Date:   Wed Feb 8 12:28:42 2017 +1300

    Split --report-size into --max-text-report-size - the defaults for each are not really compatible and --text should emit everything by default.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/config.py          | 1 +
 diffoscope/main.py            | 6 ++++++
 diffoscope/presenters/text.py | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/diffoscope/config.py b/diffoscope/config.py
index 624c27c..5512f64 100644
--- a/diffoscope/config.py
+++ b/diffoscope/config.py
@@ -28,6 +28,7 @@ class Config(object):
     # GNU diff cannot process arbitrary large files :(
     max_diff_input_lines = 2 ** 20
     max_report_size = 2000 * 2 ** 10 # 2000 kB
+    max_text_report_size = 0
     max_report_child_size = 500 * 2 ** 10
     new_file = False
     fuzzy_threshold = 60
diff --git a/diffoscope/main.py b/diffoscope/main.py
index 3c48a6c..79c1337 100644
--- a/diffoscope/main.py
+++ b/diffoscope/main.py
@@ -107,6 +107,11 @@ def create_parser():
     group2.add_argument('--no-default-limits', action='store_true', default=False,
                         help='Disable most default limits. Note that text '
                         'output already ignores most of these.')
+    group2.add_argument('--max-text-report-size', metavar='BYTES',
+                        dest='max_text_report_size', type=int,
+                        help='Maximum bytes written in --text report. (0 to '
+                        'disable)', default=None).completer=RangeCompleter(0,
+                        Config().max_text_report_size, 200000)
     group2.add_argument('--max-report-size', metavar='BYTES',
                         dest='max_report_size', type=int,
                         help='Maximum bytes written in report. In html-dir '
@@ -229,6 +234,7 @@ def run_diffoscope(parsed_args):
     if not tlsh and Config().fuzzy_threshold != parsed_args.fuzzy_threshold:
         logger.warning('Fuzzy-matching is currently disabled as the "tlsh" module is unavailable.')
     maybe_set_limit(Config(), parsed_args, "max_report_size")
+    maybe_set_limit(Config(), parsed_args, "max_text_report_size")
     maybe_set_limit(Config(), parsed_args, "max_report_child_size")
     # need to set them in this order due to Config._check_constraints
     maybe_set_limit(Config(), parsed_args, "max_diff_block_lines_saved")
diff --git a/diffoscope/presenters/text.py b/diffoscope/presenters/text.py
index ab54d19..0e2558b 100644
--- a/diffoscope/presenters/text.py
+++ b/diffoscope/presenters/text.py
@@ -32,7 +32,7 @@ class TextPresenter(Presenter):
     def __init__(self, print_func, color):
         self.print_func = create_limited_print_func(
             print_func,
-            Config().max_report_size,
+            Config().max_text_report_size,
         )
         self.color = color
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list