racket/collects/meta/drdr/diffcmd.ss
Jay McCarthy 7a294ffd7e - Allowing non-UTF8 output to be displayed in some way.
** http://drdr.plt-scheme.org/18034/collects/tests/mzscheme/benchmarks/shootout/mandelbrot-generic.ss
- Adding Robby's new graphing system
- Catching file difference errors
- Handling new files differently

svn: r18324
2010-02-24 18:49:44 +00:00

35 lines
1.0 KiB
Scheme

#lang scheme
(require scheme/system
"dirstruct.ss"
"status.ss"
(except-in "diff.ss"
log-different?)
"path-utils.ss"
"cache.ss"
"config.ss")
(define event-print
(match-lambda
[(struct stdout (bs))
(display bs) (newline)]
[(struct stdout (bs))
(display bs (current-error-port)) (newline)]))
(define (render-output-diff r1 r2 f)
(define l1 (status-output-log (read-cache (build-path (revision-log-dir r1) f))))
(define l2 (status-output-log (read-cache (build-path (revision-log-dir r2) f))))
(for ([d (in-list (render-log-difference l1 l2))])
(match d
[(struct difference (e1 e2))
(printf "! ")
(event-print e1)]
[(struct same-itude (e))
(printf " ")
(event-print e)])))
(command-line #:program "diffcmd"
#:args (rev1 rev2 filename)
(render-output-diff (string->number rev1)
(string->number rev2)
filename))