[m-dev.] diff: restorerevisions script.
Tyson Dowd
trd at cs.mu.OZ.AU
Wed Dec 8 14:39:37 AEDT 1999
Hi,
I wrote this script to restore the .revisions.gz files created by the
backup script.
===================================================================
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.
Index: tools/restorerevisions
===================================================================
RCS file: restorerevisions
diff -N restorerevisions
--- /dev/null Thu Mar 4 04:20:11 1999
+++ restorerevisions Wed Dec 8 14:37:12 1999
@@ -0,0 +1,39 @@
+#!/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
+# restorerevisions < 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: $?";
+ }
+}
+
+
--
Tyson Dowd #
# Surreal humour isn't eveyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list