Commit 5d3c3026 authored by Leigh B Stoller's avatar Leigh B Stoller

Changes to import from a git log instead of CVS history file.

parent dfaa3bc2
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2004, 2005 University of Utah and the Flux Group. # Copyright (c) 2004-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
use English; use English;
...@@ -32,7 +32,7 @@ my $debug = 0; ...@@ -32,7 +32,7 @@ my $debug = 0;
# #
# Only root can run this script. # Only root can run this script.
# #
if ($UID) { if (0 && $UID) {
die("*** $0:\n". die("*** $0:\n".
" Only root can run this script\n"); " Only root can run this script\n");
} }
...@@ -42,11 +42,12 @@ if ($UID) { ...@@ -42,11 +42,12 @@ if ($UID) {
# #
my $TB = "@prefix@"; my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@"; my $TBOPS = "@TBOPSEMAIL@";
my $INPUTLOG = "/usr/testbed/scratch/CVS/CVSROOT/commitlogs/testbed"; my $GIT = "/usr/local/bin/git";
my $GITDIR = "/z/GIT/emulab-devel.git";
my $OUTPUTLOG = "$TB/www/doc/ChangeLog.txt"; my $OUTPUTLOG = "$TB/www/doc/ChangeLog.txt";
my $MONTHROOT = "$TB/www/doc/ChangeLog"; my $MONTHROOT = "$TB/www/doc/ChangeLog";
my $HTMLFILE = "$TB/www/doc/changelog-months.html"; my $HTMLFILE = "$TB/www/doc/changelog-months.html";
my $STARTDATE = "2003/10"; my $STARTDATE = "2003-10";
my $tempname = "/tmp/import.$$"; my $tempname = "/tmp/import.$$";
my @entries = (); my @entries = ();
...@@ -79,8 +80,9 @@ if (defined($options{d})) { ...@@ -79,8 +80,9 @@ if (defined($options{d})) {
$debug = 1; $debug = 1;
} }
if (!open(INPUT, $INPUTLOG)) { if (!open(INPUT, "$GIT --git-dir=$GITDIR log ".
fatal("Could not open $INPUTLOG for reading!"); "--pretty=medium --numstat --date=iso --reverse |")) {
fatal("Could not start $GIT log process!");
} }
if (!open(OUTPUT, "> $tempname")) { if (!open(OUTPUT, "> $tempname")) {
fatal("Could not open $tempname for writing!"); fatal("Could not open $tempname for writing!");
...@@ -90,12 +92,18 @@ if (!open(OUTPUT, "> $tempname")) { ...@@ -90,12 +92,18 @@ if (!open(OUTPUT, "> $tempname")) {
# Skip to approximate start date. # Skip to approximate start date.
# #
while (<INPUT>) { while (<INPUT>) {
if ($_ =~ /^\w*\s*(\d\d\d\d\/\d\d)\/\d\d\s*\d\d:\d\d:\d\d\s*\w\w\w$/) { if ($_ =~
/^Date:\s*(\d\d\d\d\-\d\d)\-\d\d\s*\d\d:\d\d:\d\d\s*[+-]?\w\w\w\w$/) {
if ($1 eq $STARTDATE) { if ($1 eq $STARTDATE) {
last; last;
} }
} }
} }
while (<INPUT>) {
if ($_ =~ /^commit\s*[\w]*$/) {
last;
}
}
my $entry = $_; my $entry = $_;
# #
...@@ -105,13 +113,18 @@ my $this_month = $STARTDATE; ...@@ -105,13 +113,18 @@ my $this_month = $STARTDATE;
my $index = 0; my $index = 0;
my @month_index = ($STARTDATE); my @month_index = ($STARTDATE);
my %month_data = ($STARTDATE => []); my %month_data = ($STARTDATE => []);
my $month;
while (<INPUT>) { while (<INPUT>) {
if ($_ =~ /^\w*\s*(\d\d\d\d\/\d\d)\/\d\d\s*\d\d:\d\d:\d\d\s*\w\w\w$/) { if ($_ =~
/^Date:\s*(\d\d\d\d\-\d\d)\-\d\d\s*\d\d:\d\d:\d\d\s*[+-]?\w\w\w\w$/) {
$month = $1;
}
elsif ($_ =~ /^commit\s*[\w]*$/) {
unshift(@{ $month_data{$this_month} }, $entry); unshift(@{ $month_data{$this_month} }, $entry);
$entry = $_; $entry = $_;
if ($1 ne $this_month) { if ($month ne $this_month) {
$this_month = $1; $this_month = $month;
$index++; $index++;
$month_index[$index] = $this_month; $month_index[$index] = $this_month;
$month_data{$this_month} = []; $month_data{$this_month} = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment