mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-19 07:45:09 +00:00
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.
40 lines
862 B
Perl
Executable File
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: $?";
|
|
}
|
|
}
|
|
|
|
|