1 | ;;; Copyright (C) 2006 Magnus Henoch |
---|
2 | ;;; |
---|
3 | ;;; This program is free software; you can redistribute it and/or |
---|
4 | ;;; modify it under the terms of the GNU General Public License as |
---|
5 | ;;; published by the Free Software Foundation; either version 2 of the |
---|
6 | ;;; License, or (at your option) any later version. |
---|
7 | ;;; |
---|
8 | ;;; This program is distributed in the hope that it will be useful, |
---|
9 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
11 | ;;; General Public License for more details. |
---|
12 | ;;; |
---|
13 | ;;; You should have received a copy of the GNU General Public License |
---|
14 | ;;; along with this program; if not, write to the Free Software |
---|
15 | ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
16 | |
---|
17 | (in-package :darcs) |
---|
18 | |
---|
19 | (defgeneric display-patch (patch stream) |
---|
20 | (:documentation |
---|
21 | "Print an elaborate and readable description of PATCH to STREAM.")) |
---|
22 | |
---|
23 | (defmethod display-patch ((patch patch) stream) |
---|
24 | "When no display method is defined, write a terse description." |
---|
25 | (print patch stream)) |
---|
26 | |
---|
27 | (defmethod display-patch ((patch hunk-patch) stream) |
---|
28 | (format stream "~&~A: ~A~[~:;~:*-~A~]~[~:;~:*+~A~]" |
---|
29 | (patch-filename patch) |
---|
30 | (hunk-line-number patch) |
---|
31 | (length (hunk-old-lines patch)) |
---|
32 | (length (hunk-new-lines patch))) |
---|
33 | (dolist (old (hunk-old-lines patch)) |
---|
34 | (format stream "~&-~A" (bytes-to-string old))) |
---|
35 | (dolist (new (hunk-new-lines patch)) |
---|
36 | (format stream "~&+~A" (bytes-to-string new)))) |
---|