#!/usr/bin/perl # # This script restores files to the CVS revisions specified by the # input. It expects revisions specified as # directory name/CVS/Entries # ... # contents of Entries file # ... # # This is how revisions files are generated by the script # backuprevisions. # # To use this script: # cvs co module # cd module # restorerevisitons < revisionsfile # # You can then apply patches using cvspatch: # cd module # cvspatch difffile # while () { if (/(.*)\/CVS/) { printf("Entering directory: %s\n", $1); $dir = $1; } elsif (/^D\/(.*)\/(.*)\/(.*)\/(.*)\//) { # Do nothing in this case } elsif (/^\/(.*)\/(.*)\/(.*)\/(.*)\//) { $file = $1; $rev = $2; printf("Restore $dir/$file to revision $rev\n"); @args = ("cvs", "update", "-r", $rev, "$dir/$file"); system(@args) == 0 or die "system @args failed: $?"; } }