]> thyrsus.com Git - comparator.git/commitdiff
Better reporting format.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 11 Mar 2004 02:04:30 +0000 (02:04 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 11 Mar 2004 02:04:30 +0000 (02:04 +0000)
filterator

index 6b69ae139530a2ec37e178480d66ab9a6d90da0a..47622b5f41c447c065093f548e60838b3af13ad7 100755 (executable)
@@ -4,7 +4,7 @@
 #
 import sys, comparator, re
 
-def reporthook(clique):
+def shortreport(clique):
     rep = ""
     (file, start, end, text) = state.extract_text(clique)
     if start == 1 and end == state.files[file]:
@@ -16,6 +16,17 @@ def reporthook(clique):
         rep += text
     return rep
 
+def longreport(clique):
+    rep = ""
+    (tfile, tstart, tend, text) = state.extract_text(clique)
+    for (file, start, end) in clique:
+        if start == 1 and end == state.files[file]:
+            rep += "%% %s:%d-%d: (entire)\n" % (file, start, end)
+        else:
+            rep += "%% %s:%d-%d:\n" % (file, start, end)
+    rep += text
+    return rep
+
 if __name__ == '__main__':
     # Main line begins here
     import getopt
@@ -54,7 +65,7 @@ if __name__ == '__main__':
             state.cliquefilter(lambda file, start, end: file in matchfiles)
         try:
             if expand:
-                state.metadump(sys.stdout, (75 * '-')+"\n", reporthook, {"Minimum-Size":minsize})
+                state.metadump(sys.stdout, (75 * '-')+"\n", longreport, {"Minimum-Size":minsize})
             else:
                 state.dump(sys.stdout)
         except (KeyboardInterrupt, IOError):