[Zope-CVS] CVS: Products/ZCTextIndex/tests - hs-tool.py:1.1.2.3

Jeremy Hylton jeremy@zope.com
Tue, 14 May 2002 01:21:33 -0400


Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv18562

Modified Files:
      Tag: TextIndexDS9-branch
	hs-tool.py 
Log Message:
Printed the files in sorted order with -A.

Expand fmt for line prefix to %8d %8d because %5d overflowed too often.


=== Products/ZCTextIndex/tests/hs-tool.py 1.1.2.2 => 1.1.2.3 ===
         if not place:
             continue
-        hits, time = stats
+        time, hits = stats
         file, line, func = place
         l = files.get(file)
         if l is None:
             l = files[file] = []
         l.append((line, hits, time))
-    for k, v in files.items():
+    order = files.keys()
+    order.sort()
+    for k in order:
         if os.path.exists(k):
+            v = files[k]
             v.sort()
             annotate(k, v)
 
 def annotate(file, lines):
+    print "-" * 60
+    print file
+    print "-" * 60
     f = open(file)
     i = 1
     match = lines[0][0]
     for line in f:
         if match == i:
-            print "%5d %5d " % lines[0][1:], line,
+            print "%6d %8d " % lines[0][1:], line,
             del lines[0]
             if lines:
                 match = lines[0][0]
             else:
                 match = None
         else:
-            print " " * 12, line,
+            print " " * 16, line,
         i += 1
+    print
 
 def get_cache_name(filename):
     d, fn = os.path.split(filename)