#!/bin/sh # # Convert CVS's diff format to patch's. # # This program acts like a unix filter: send it a # CVS patch on stdin and it'll print a patch-compatible # patch on stdout. # # You *must* use the -u option to "cvs diff"! grep -v "^cvs diff: " | # no need to pass '-q' awk ' /^Index: / { file = $2 } /^diff -u -r/ { a = $3; b = $4; if (b !~ /^-r/) b = "HEAD" $0 = "diff --cvsish " a "/" file " " b "/" file } /^--- / { $2 = a "/" $2 } /^\+\+\+ / { $2 = b "/" $2 } { print } ' exit # Some sample diff headers: Index: foo.txt =================================================================== RCS file: /cvs/foo.txt,v retrieving revision 1.6 retrieving revision 1.5 diff -u -r1.6 -r1.5 --- foo.txt 29 Dec 2008 21:12:45 -0000 1.6 +++ foo.txt 27 Aug 2008 20:05:37 -0000 1.5 @@ -45,19 +45,20 @@ Index: bar.txt =================================================================== RCS file: /cvs/bar.txt,v retrieving revision 1.22 diff -u -r1.22 bar.txt --- bar.txt 8 Nov 2008 19:59:03 -0000 1.22 +++ bar.txt 16 Jan 2009 21:38:21 -0000 @@ -42,7 +42,6 @@