Date: Fri, 30 Jun 2000 01:42:10 +0100 From: Nik Clayton <nik@freebsd.org> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: Nik Clayton <nik@FreeBSD.org>, doc@FreeBSD.org, committers@FreeBSD.org, dgl@bsdi.com, jim@cdrom.com, papowell@astart.com, wpaul@FreeBSD.org, ceren@magnesium.net, ryan@ryan.net, murray@bsdi.com Subject: Re: The website Message-ID: <20000630014210.A35224@catkin.nothing-going-on.org> In-Reply-To: <17146.962016763@critter.freebsd.dk>; from phk@critter.freebsd.dk on Mon, Jun 26, 2000 at 12:52:43PM %2B0200 References: <20000625200029.I470@kilt.nothing-going-on.org> <17146.962016763@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
--qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 26, 2000 at 12:52:43PM +0200, Poul-Henning Kamp wrote: > * Other topic for dynamic content: HTML'ed page with the last 24h > of commit logs, ie: pointers into cvsweb to see the diffs. Here's the beginnings of something that could mutate in to this. Simply iterate over each non-.gz file in the commitlogs directory, pulling out the timestamp (which is on the first line of each commit message), the filename involved, and the tell() position within the file for future reference. Sort the list of timestamps in reverse chronological order. Then, for the top three (i.e., the most recent three commits) re-open the file, seek back to the right position for the appropriate commit message, and then display the log message. N -- Internet connection, $19.95 a month. Computer, $799.95. Modem, $149.95. Telephone line, $24.95 a month. Software, free. USENET transmission, hundreds if not thousands of dollars. Thinking before posting, priceless. Somethings in life you can't buy. For everything else, there's MasterCard. -- Graham Reed, in the Scary Devil Monastery --qMm9M+Fa2AknHoGS Content-Type: application/x-perl Content-Disposition: attachment; filename="commit.pl" #!/usr/bin/perl -w # # Scan through the commit logs, shows the last three commits use strict; use IO::Seekable; # SEEK_* constants my $logdir = "/home/ncvs/CVSROOT/commitlogs"; my @logs = (); # Commitlog filenames my %commits = (); # Commit map my $log = ''; # Current commitlog filename my $tstamp = ''; # Timstamp my $max_hist = 3; # How far back to go my $cur_hist = 1; # How far back have we gone? # Get a list of all the files in $logdir that only contain [a-z]. This # gets rid of all the .gz files. opendir(D, $logdir); @logs = grep { /^[a-z]+$/ && -f "$logdir/$_" } readdir(D); closedir(D); # Iterate over all the logs, storing the timestamps of each commit, along # with their position in the log and the file involved. foreach $log (@logs) { open(L, "<$logdir/$log") or die "Can't open $log: $!\n"; while(<L>) { next if $_ !~ /^[a-z]/; # Skip non-header lines chomp; # It's a header line, pull out the timestamp, and store the # filename and current file position as a ref-to-array in the # hash. (undef, $tstamp) = split(/\s+/, $_, 2); $commits{$tstamp} = [ $log, tell(L) ]; } close(L); } foreach $tstamp (reverse sort keys %commits) { last if $cur_hist > $max_hist; # Only print $max_hist entries open(L, "<$logdir/$commits{$tstamp}[0]") or die "Can't open $commits{$tstamp}[0]_: $!\n"; seek(L, $commits{$tstamp}[1], SEEK_SET); # Print out the log message print "$tstamp\n"; while(<L>) { last if $_ =~ /^[a-z]/; # Encountered a new header line # so stop what we're doing print $_; # Print this line } close(L); $cur_hist++; } --qMm9M+Fa2AknHoGS-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000630014210.A35224>