From owner-freebsd-doc Thu Jun 29 18: 2:40 2000 Delivered-To: freebsd-doc@freebsd.org Received: from nothing-going-on.demon.co.uk (nothing-going-on.demon.co.uk [193.237.89.66]) by hub.freebsd.org (Postfix) with ESMTP id 7E54B37B686; Thu, 29 Jun 2000 18:02:24 -0700 (PDT) (envelope-from nik@nothing-going-on.demon.co.uk) Received: (from nik@localhost) by nothing-going-on.demon.co.uk (8.9.3/8.9.3) id BAA41133; Fri, 30 Jun 2000 01:42:11 +0100 (BST) (envelope-from nik) Date: Fri, 30 Jun 2000 01:42:10 +0100 From: Nik Clayton To: Poul-Henning Kamp Cc: Nik Clayton , 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> References: <20000625200029.I470@kilt.nothing-going-on.org> <17146.962016763@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qMm9M+Fa2AknHoGS" Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <17146.962016763@critter.freebsd.dk>; from phk@critter.freebsd.dk on Mon, Jun 26, 2000 at 12:52:43PM +0200 Organization: FreeBSD Project Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --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() { 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() { 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