[Python-Dev] Processing CVS diffs

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat, 12 Aug 2000 11:29:25 +0200


While looking at the comments for Patch #100654, I noticed a complaint
about the patch being a CVS diff, which is not easily processed by
patch.

There is a simple solution to that: process the patch with the script
below. It will change the patch in-place, and it works well for me
even though it is written in the Evil Language :-)

Martin

#! /usr/bin/perl -wi
# Propagate the full pathname from the Index: line in CVS output into
# the diff itself so that patch will use it.
#  Thrown together by Jason Merrill <jason@cygnus.com>

while (<>)
{
  if (/^Index: (.*)/) 
    {
      $full = $1;
      print;
      for (1..7)
	{
	  $_ = <>;
	  s/ [^\t]+\t/ $full\t/;
	  print;
	}
    }
  else
    {
      print;
    }
}