[diffoscope] 01/03: comparators.utils.file: Tidy _compare_using_details

Chris Lamb chris at chris-lamb.co.uk
Sat Apr 15 00:00:30 CEST 2017


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

lamby pushed a commit to branch experimental
in repository diffoscope.

commit 6efbd5e9f2de347294f56c510bec84c808ff6172
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Apr 14 21:56:02 2017 +0100

    comparators.utils.file: Tidy _compare_using_details
    
    Gbp-Dch: ignore
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/utils/file.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/diffoscope/comparators/utils/file.py b/diffoscope/comparators/utils/file.py
index 538cafa..611aa93 100644
--- a/diffoscope/comparators/utils/file.py
+++ b/diffoscope/comparators/utils/file.py
@@ -188,14 +188,18 @@ class File(object, metaclass=abc.ABCMeta):
 
     def _compare_using_details(self, other, source):
         details = []
+        difference = Difference(None, self.name, other.name, source=source)
+
         if hasattr(self, 'compare_details'):
-            details.extend(filter(None, self.compare_details(other, source)))
+            details.extend(self.compare_details(other, source))
         if self.as_container:
-            details.extend(filter(None, self.as_container.compare(other.as_container)))
+            details.extend(self.as_container.compare(other.as_container))
+
+        details = [x for x in details if x]
         if not details:
             return None
-        difference = Difference(None, self.name, other.name, source=source)
         difference.add_details(details)
+
         return difference
 
     def has_same_content_as(self, other):

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


More information about the diffoscope mailing list