From 080bcf4d4ee0c96b649b26c7c8423c39ec4f91a4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 11 Mar 2004 00:57:39 +0000 Subject: [PATCH] Do counting correctly. --- comparator.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/comparator.py b/comparator.py index 0faf309..e4860af 100644 --- a/comparator.py +++ b/comparator.py @@ -164,17 +164,20 @@ class CommonReport: for (treename, dummy) in self.trees: matches[treename] = matchlines[treename] = 0 for clique in self.cliques: - firstmatch = {} + intree = {} for (treename, dummy) in self.trees: - firstmatch[treename] = 0 + intree[treename] = False for (file, start, end) in clique: for (treename, properties) in self.trees: if treename == file.split("/")[0]: break - if not treename in firstmatch: - properties['matches'] += 1 - firstmatch[tree] = True - properties['matchlines'] += end - start + 1 + if not treename in intree: + matches[treename] += 1 + intree[tree] = True + matchlines[treename] += end - start + 1 + for (treename, properties) in self.trees: + properties['matches'] = matches[treename] + properties['matchlines'] = matchlines[treename] self.matches = len(self.cliques) def cliquedump(self, clique): -- 2.43.0