]> thyrsus.com Git - comparator.git/commitdiff
Do counting correctly.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 11 Mar 2004 00:57:39 +0000 (00:57 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 11 Mar 2004 00:57:39 +0000 (00:57 +0000)
comparator.py

index 0faf30939090ecd70ec26c34c9cf3076bce319a0..e4860affc04ad1b695f2cdc6730ae9887d58a052 100644 (file)
@@ -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):