Files
mercury/tools/restorerevisions
Tyson Dowd c85a3a2f7a Add a tool to restore a checked out CVS repository to a given
Estimated hours taken: 1.5

tools/restorerevisions:
	Add a tool to restore a checked out CVS repository to a given
	set of revisions.  This is the restore script for the backupdir
	and backuprevision scripts which create a revisions file.
1999-12-09 03:37:12 +00:00

40 lines
862 B
Perl
Executable File

#!/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 (<STDIN>) {
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: $?";
}
}