#!/usr/bonsaitools/bin/perl -- # -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Netscape Public License # Version 1.0 (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://www.mozilla.org/NPL/ # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the # License for the specific language governing rights and limitations # under the License. # # The Original Code is the Bonsai CVS tool. # # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are Copyright (C) 1998 # Netscape Communications Corporation. All Rights Reserved. # Query the CVS database. # require 'lloydcgi.pl'; require 'cvsmenu.pl'; require 'utils.pl'; $|=1; $CVS_ROOT = $form{"cvsroot"}; print "Content-type: text/html\n\n"; require 'modules.pl'; EmitHtmlHeader("CVS Query Form", $CVS_ROOT); print "

"; # # module selector # print " \n"; print ""; # # Branch # if( defined $form{branch} ){ $b = $form{branch}; } else { $b = "HEAD"; } print ""; # # Query by directory # print " "; print " "; # # Who # print " "; # # Log contains # #print " #
#Log contains: #(you can use regular expressions)\n"; # # Sort order # print " "; # # Print the date selector # $CVS_REPOS_SUFFIX = $CVS_ROOT; $CVS_REPOS_SUFFIX =~ s:/:_:g; $startdate = fetchCachedStartDate($CVS_ROOT); if ($form{date} eq "") { $form{date} = "hours"; } print " "; print "
Module: "; cvsmenu(); print "
Branch:
\n" . regexpradio('branchtype') . "
(leaving this field empty will show you checkins on both HEAD and branches)
Directory:
(you can list multiple directories)
File:
" . regexpradio('filetype') . "
Who:
" . regexpradio('whotype') . "
Sort By:

Date:
In the last hours
In the last day
In the last week
In the last month
Since the beginning of time (which happens to be $startdate currently)
Between You can use the form mm/dd/yy hh:mm:ss or a Unix time_t (seconds since the Epoch.)
and

"; sub sortTest { if( $_[0] eq $form{sortby} ){ return " SELECTED"; } else { return ""; } } refigureStartDateIfNecessary($CVS_ROOT); sub dateTest { if( $_[0] eq $form{date} ){ return " CHECKED value=$_[0]"; } else { return "value=$_[0]"; } } sub regexpradio { my($name) = @_; my $useregexp = ($form{$name} eq 'regexp'); my $c1 = $useregexp ? "" : "checked"; my $c2 = $useregexp ? "checked" : ""; return " Exact match       Regular expression"; } sub fetchCachedStartDate { my ($repository) = @_; open(CACHE, ") { chop(); my($rep,$date,$cachedate) = split(/\|/); if ($rep eq $repository) { $rememberedcachedate = $cachedate; return $date; } } return "unknown"; } sub refigureStartDateIfNecessary { my ($repository) = @_; my $now = time(); if ((defined $rememberedcachedate) && $now - $rememberedcachedate < 24*60*60 && $rememberedcachedate < $now) { return; } my $db = ConnectToDatabase(); my $query = $db->Query("select min(when) from checkins,repositories where repositories.id = repositoryid and repository = '$CVS_ROOT'") || die $Mysql::db_errstr; my @row = $query->fetchrow(); my $startdate = $row[0]; if ($startdate eq "") { $startdate = "nonexistant"; } open(OUTCACHE, ">data/cachedstartdates.$$") || die "Can't open output date cache file"; if (open(INCACHE, ") { chop(); my($rep,$date,$cachedate) = split(/\|/); if ($rep ne $repository) { print OUTCACHE "$_\n"; } } close INCACHE; } print OUTCACHE "$repository|$startdate|$now\n"; close OUTCACHE; rename "data/cachedstartdates.$$", "data/cachedstartdates"; }