[diffoscope] 01/12: Add new feature to hide metadata generated by gzip more details : https://wiki.debian.org/ReproducibleBuilds/HideProfilesSpecification

Maria Glukhova siamezzze-guest at moszumanska.debian.org
Wed Mar 8 15:59:09 CET 2017


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

siamezzze-guest pushed a commit to branch siamezzze/hide-profiles-experiment
in repository diffoscope.

commit ffc2bb214dd651f3dcfd63bff592230fe89eff96
Author: Satyam Zode <satyamzode at gmail.com>
Date:   Thu Jun 2 15:16:08 2016 +0530

     Add new feature to hide metadata generated by gzip
     more details : https://wiki.debian.org/ReproducibleBuilds/HideProfilesSpecification
---
 diffoscope/config.py               | 1 +
 diffoscope/main.py                 | 3 +++
 diffoscope/presenters/html/html.py | 4 ++++
 diffoscope/presenters/text.py      | 3 +++
 4 files changed, 11 insertions(+)

diff --git a/diffoscope/config.py b/diffoscope/config.py
index 025790d..0be2e39 100644
--- a/diffoscope/config.py
+++ b/diffoscope/config.py
@@ -34,6 +34,7 @@ class Config(object):
     fuzzy_threshold = 60
     enforce_constraints = True
     excludes = ()
+    hide_profile = None
 
     _singleton = {}
 
diff --git a/diffoscope/main.py b/diffoscope/main.py
index 4ed97d3..0038f68 100644
--- a/diffoscope/main.py
+++ b/diffoscope/main.py
@@ -154,6 +154,8 @@ def create_parser():
                         'trying to emit it in a report. This also affects --text '
                         'output. (0 to disable, default: 0)',
                         default=0).completer=RangeCompleter(0, 0, 200)
+    group2.add_argument('--hide', dest='hide_profile', action='store',
+                        choices={'metadata'}, help='hide certain differences')
 
     group3 = parser.add_argument_group('diff calculation')
     group3.add_argument('--new-file', dest='new_file', action='store_true',
@@ -252,6 +254,7 @@ def run_diffoscope(parsed_args):
     Config().fuzzy_threshold = parsed_args.fuzzy_threshold
     Config().new_file = parsed_args.new_file
     Config().excludes = parsed_args.excludes
+    Config().hide_profile = parsed_args.hide_profile
     set_locale()
     logger.debug('Starting comparison')
     ProgressManager().setup(parsed_args)
diff --git a/diffoscope/presenters/html/html.py b/diffoscope/presenters/html/html.py
index bf8e049..2d35e1e 100644
--- a/diffoscope/presenters/html/html.py
+++ b/diffoscope/presenters/html/html.py
@@ -439,6 +439,10 @@ def escape_anchor(val):
     return val
 
 def output_difference(difference, print_func, css_url, directory, parents):
+    if Config.hide_profile is not None:
+        if difference.source1 in Config.hide_profile:
+            logger.debug('output for %s is hidden', difference.source1)
+            return
     logger.debug('html output for %s', difference.source1)
     sources = parents + [difference.source1]
     print_func(u'<div class="difference">')
diff --git a/diffoscope/presenters/text.py b/diffoscope/presenters/text.py
index 0e2558b..5e20153 100644
--- a/diffoscope/presenters/text.py
+++ b/diffoscope/presenters/text.py
@@ -45,6 +45,9 @@ class TextPresenter(Presenter):
             self.print_func("Max output size reached.", force=True)
 
     def visit_difference(self, difference):
+        if Config.hide_profile is not None and \
+                        difference.source1 in Config.hide_profile:
+            return
         if self.depth == 0:
             self.output("--- {}".format(difference.source1))
             self.output("+++ {}".format(difference.source2))

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


More information about the diffoscope mailing list