Skip to content

Commit be0c74d

Browse files
committed
applying patches
1 parent 2549873 commit be0c74d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

package.lisp

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#:apply-seq-window
1111
#:apply-seq-diff
12+
#:apply-seq-patch
13+
#:apply-patch
1214

1315
#:render-diff
1416
#:render-diff-window

patch.lisp

+11
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,14 @@
341341
:index-file (and index (pathname index))
342342
:prereq-string prereq)
343343
patches)))))))
344+
345+
(defun apply-seq-patch (original-seq patch)
346+
"Apply PATCH to the sequence ORIGINAL-SEQ."
347+
(apply-seq-diff original-seq (diff patch)))
348+
349+
(defun apply-patch (patch &aux original)
350+
"Apply PATCH."
351+
(do-file-lines (line (original-pathname (diff patch))) (push line original))
352+
(with-open-file (out (original-pathname (diff patch))
353+
:direction :output :if-exists :supersede)
354+
(format out "~{~a~^~%~}~%" (apply-seq-patch (nreverse original) patch))))

0 commit comments

Comments
 (0)