1#!/usr/local/bin/perl -w
2# This Source Code Form is subject to the terms of the Mozilla Public
3# License, v. 2.0. If a copy of the MPL was not distributed with this
4# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5#
6# This Source Code Form is "Incompatible With Secondary Licenses", as
7# defined by the Mozilla Public License, v. 2.0.
8
9# Keep a record of all cvs updates made from a given directory.
10#
11# Later, if changes need to be backed out, look at the log file
12# and run the cvs command with the date that you want to back
13# out to. (Probably the second to last entry).
14
15# Because this script lives in contrib, you may want to
16#   ln -s contrib/cvs-update.pl cvs-update.pl
17# from your bugzilla install directory so you can run
18# the script easily from there (./cvs-update.pl)
19
20#DATE=`date +%e/%m/%Y\ %k:%M:%S\ %Z`
21
22my ($second, $minute, $hour, $day, $month, $year) = gmtime;
23my $date = sprintf("%04d-%02d-%02d %d:%02d:%02dZ",
24                   $year+1900, $month+1, $day, $hour, $minute, $second);
25my $cmd = "cvs -q update -dP";
26open LOG, ">>cvs-update.log" or die("Couldn't open cvs update log!");
27print LOG "$cmd -D \"$date\"\n";
28close LOG;
29system("$cmd -A");
30
31# sample log file
32#cvs update -P -D "11/04/2000 20:22:08 PDT"
33#cvs update -P -D "11/05/2000 20:22:22 PDT"
34#cvs update -P -D "11/07/2000 20:26:29 PDT"
35#cvs update -P -D "11/08/2000 20:27:10 PDT"
36