[diffoscope] 01/02: presenters: html: Don't traverse children whose parents were already limited (Closes: #871413)

Ximin Luo infinity0 at debian.org
Thu Aug 17 15:24:49 CEST 2017


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

infinity0 pushed a commit to branch master
in repository diffoscope.

commit ed0d530598003496f9760be9d4e152b1cde2e096
Author: Ximin Luo <infinity0 at debian.org>
Date:   Thu Aug 17 15:17:49 2017 +0200

    presenters: html: Don't traverse children whose parents were already limited (Closes: #871413)
---
 diffoscope/presenters/html/html.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/diffoscope/presenters/html/html.py b/diffoscope/presenters/html/html.py
index dd3ace8..518e260 100644
--- a/diffoscope/presenters/html/html.py
+++ b/diffoscope/presenters/html/html.py
@@ -569,7 +569,11 @@ class HTMLPresenter(Presenter):
             # Difference is not comparable so use memory address in event of a tie
             return depth, node.size_self(), id(node), parents + [node]
 
+        pruned = set() # children
         for node, score in difference.traverse_heapq(smallest_first, yield_score=True):
+            if node in pruned:
+                continue
+
             ancestor = ancestors.pop(node, None)
             path = score[3]
             diff_path = output_diff_path(path)
@@ -605,10 +609,13 @@ class HTMLPresenter(Presenter):
                     footer = output_footer()
                     if not make_new_subpage: # we hit a limit, either max-report-size or single-page
                         if not outputs:
-                            # no more holes, don't iterate through any more children
+                            # no more holes, don't traverse any more nodes
                             break
                         else:
-                            # more holes to fill up with "limit reached" placeholders
+                            # don't traverse this node's children, they won't be output
+                            # however there are holes in other pages, so don't break just yet
+                            for child in node.details:
+                                pruned.add(child)
                             continue
                 else:
                     # unconditionally write the root node regardless of limits

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


More information about the diffoscope mailing list