# -*- 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. require 'globals.pl'; require 'get_line.pl'; # # Constants # $CI_CHANGE=0; $CI_DATE=1; $CI_WHO=2; $CI_REPOSITORY=3; $CI_DIR=4; $CI_FILE=5; $CI_REV=6; $CI_STICKY=7; $CI_BRANCH=8; $CI_LINES_ADDED=9; $CI_LINES_REMOVED=10; $CI_LOG=11; $NOT_LOCAL = 1; $IS_LOCAL = 2; chomp($CVS_ROOT) if defined($CVS_ROOT); if (!defined($CVS_ROOT) || $CVS_ROOT eq "" ){ $CVS_ROOT = pickDefaultRepository(); } #global variables $lines_added = 0; $lines_removed = 0; $modules = {}; $CVS_MODULES="${CVS_ROOT}/CVSROOT/modules"; open( MOD, "<$CVS_MODULES") || die "can't open ${CVS_MODULES}"; &parse_modules; close( MOD ); 1; # # Actually do the query # sub query_checkins { my (%mod_map) = @_; my ($ci,$result,$lastlog,$rev,$begin_tag,$end_tag); if( $query_module ne 'all' && $query_module ne 'allrepositories' && @query_dirs == 0 ){ $have_mod_map = 1; %mod_map = &get_module_map( $query_module ); } else { $have_mod_map = 0; %mod_map = (); } for $i (@query_dirs ){ $i =~ s:^/::; # Strip leading slash. $i =~ s:/$::; # Strip trailing slash. if( !$have_mod_map ){ %mod_map = (); $have_mod_map = 1; } $mod_map{$i} = $NOT_LOCAL; } if( $query_branch =~ /^[ ]*HEAD[ ]*$/i ){ $query_branch_head = 1; } $begin_tag = ""; $end_tag = ""; if (defined($query_begin_tag) && $query_begin_tag ne '') { $begin_tag = load_tag($query_begin_tag); } if (defined($query_end_tag) && $query_end_tag ne '') { $end_tag = load_tag($query_end_tag); } $result = []; ConnectToDatabase(); my $qstring = "select type, UNIX_TIMESTAMP(ci_when), people.who, repositories.repository, dirs.dir, files.file, revision, stickytag, branches.branch, addedlines, removedlines, descs.description from checkins,people,repositories,dirs,files,branches,descs where people.id=whoid and repositories.id=repositoryid and dirs.id=dirid and files.id=fileid and branches.id=branchid and descs.id=descid"; if( $query_module ne 'allrepositories' ){ $qstring .= " and repositories.repository = '$CVS_ROOT'"; } if ($query_date_min) { my $t = formatSqlTime($query_date_min); $qstring .= " and ci_when >= '$t'"; } if ($query_date_max) { my $t = formatSqlTime($query_date_max); $qstring .= " and ci_when <= '$t'"; } if ($query_branch_head) { $qstring .= " and branches.branch = ''"; } elsif ($query_branch ne '') { my $q = SqlQuote($query_branch); if ($query_branchtype eq 'regexp') { $qstring .= " and branches.branch regexp $q"; } elsif ($query_branchtype eq 'notregexp') { $qstring .= " and not (branches.branch regexp $q) "; } else { $qstring .= " and (branches.branch = $q or branches.branch = "; $qstring .= SqlQuote("T$query_branch") . ")"; } } if (defined $query_file && $query_file ne '') { my $q = SqlQuote($query_file); if ($query_filetype eq 'regexp') { $qstring .= " and files.file regexp $q"; } else { $qstring .= " and files.file = $q"; } } if (defined $query_who && $query_who ne '') { my $q = SqlQuote($query_who); if ($query_whotype eq 'regexp') { $qstring .= " and people.who regexp $q"; } elsif ($query_whotype eq 'notregexp') { $qstring .= " and not (people.who regexp $q)"; } else { $qstring .= " and people.who = $q"; } } if (defined($query_logexpr) && $query_logexpr ne '') { my $q = SqlQuote($query_logexpr); $qstring .= " and descs.description regexp $q"; } if ($query_debug) { print "
Query: $qstring\nTreeID is $::TreeID\n"; if ($have_mod_map) { print "Dump of module map:\n"; foreach my $k (sort(keys %mod_map)) { print value_quote("$k => $mod_map{$k}") . "\n"; } } print "\n"; } SendSQL($qstring); $lastlog = 0; while (@row = FetchSQLData()) { #print "
"; $ci = []; for ($i=0 ; $i<=$CI_LOG ; $i++) { $ci->[$i] = $row[$i]; #print "$row[$i] "; } #print ""; $key = "$ci->[$CI_DIR]/$ci->[$CI_FILE]"; if (IsHidden("$ci->[$CI_REPOSITORY]/$key")) { next; } if( $have_mod_map && !&in_module(\%mod_map, $ci->[$CI_DIR], $ci->[$CI_FILE] ) ){ next; } if( $begin_tag) { $rev = $begin_tag->{$key}; print "