From: Eric S. Raymond Date: Thu, 11 Mar 2004 02:04:30 +0000 (+0000) Subject: Better reporting format. X-Git-Tag: 2.4~3 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=34ad4e9ec7ebe66acb7a9a0c74ee5cb2b2c25a96;p=comparator.git Better reporting format. --- diff --git a/filterator b/filterator index 6b69ae1..47622b5 100755 --- a/filterator +++ b/filterator @@ -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):