Merge viewvc.pl into copy of bonsai's cvsquery.pl.
Bug #380118 r=bear git-svn-id: svn://10.0.0.236/trunk@233282 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -67,7 +67,11 @@ exit 0 if (!$use_bonsai && !$use_viewvc);
|
||||
my $lockfile = "$tree/buildwho.sem";
|
||||
my $lock = lock_datafile($lockfile);
|
||||
|
||||
require 'viewvc.pl';
|
||||
if ($use_bonsai) {
|
||||
$::CVS_ROOT = $cvs_root;
|
||||
}
|
||||
|
||||
require 'cvsquery.pl';
|
||||
|
||||
build_who($tree);
|
||||
|
||||
@@ -87,27 +91,26 @@ sub build_who {
|
||||
|
||||
print "Minimum date: $::query_date_min\n" if $F_DEBUG;
|
||||
|
||||
$::query_branchtype='regexp' if $::query_branch =~ /\*|\?|\+/;
|
||||
$::query_branch_head=1 if $::query_branch eq 'HEAD';
|
||||
|
||||
if ($use_viewvc) {
|
||||
$::query_module=$viewvc_repository;
|
||||
$result = query_checkins_viewvc($tree);
|
||||
} elsif ($use_bonsai) {
|
||||
$::query_module=$cvs_module;
|
||||
$::query_branch=$cvs_branch;
|
||||
$result = query_checkins_bonsai($tree);
|
||||
} else {
|
||||
# Should never reach this
|
||||
return;
|
||||
}
|
||||
|
||||
$::query_branchtype='regexp' if $::query_branch =~ /\*|\?|\+/;
|
||||
$::query_branch_head=1 if $::query_branch eq 'HEAD';
|
||||
|
||||
my $last_who='';
|
||||
my $last_date=0;
|
||||
my $who_file = "$tree/who.dat";
|
||||
my $temp_who_file = "$who_file.$$";
|
||||
open(WHOLOG, ">", "$temp_who_file");
|
||||
|
||||
$result = query_checkins($tree);
|
||||
|
||||
my $last_who='';
|
||||
my $last_date=0;
|
||||
for my $ci (@$result) {
|
||||
if ($ci->[$::CI_DATE] != $last_date or $ci->[$::CI_WHO] ne $last_who) {
|
||||
print WHOLOG "$ci->[$::CI_DATE]|$ci->[$::CI_WHO]\n";
|
||||
|
||||
@@ -19,50 +19,19 @@
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
require 'globals.pl';
|
||||
require 'get_line.pl';
|
||||
|
||||
use strict;
|
||||
use DBI;
|
||||
use POSIX qw(strftime mktime);
|
||||
use Time::Local;
|
||||
|
||||
# Shut up misguided -w warnings about "used only once". "use vars" just
|
||||
# doesn't work for me.
|
||||
|
||||
sub cvsquery_pl_sillyness {
|
||||
my $zz;
|
||||
$zz = $::CI_BRANCH;
|
||||
$zz = $::CI_CHANGE;
|
||||
$zz = $::CI_DATE;
|
||||
$zz = $::CI_STICKY;
|
||||
$zz = $::TreeID;
|
||||
$zz = $::query_debug;
|
||||
$zz = $::query_filetype;
|
||||
$zz = $::versioninfo;
|
||||
};
|
||||
|
||||
#
|
||||
# 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;
|
||||
# Assume that treedata.pl & tbglobals.pl are already loaded
|
||||
my $db = undef;
|
||||
|
||||
my $NOT_LOCAL = 1;
|
||||
my $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;
|
||||
@@ -70,19 +39,19 @@ $::lines_removed = 0;
|
||||
|
||||
$::modules = {};
|
||||
|
||||
my $CVS_MODULES="$::CVS_ROOT/CVSROOT/modules";
|
||||
if (defined($::CVS_ROOT) && "$::CVS_ROOT" ne "") {
|
||||
my $CVS_MODULES="$::CVS_ROOT/CVSROOT/modules";
|
||||
open( MOD, "<$CVS_MODULES") || die "can't open ${CVS_MODULES}";
|
||||
parse_modules();
|
||||
close( MOD );
|
||||
}
|
||||
|
||||
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) = @_;
|
||||
sub query_checkins_bonsai {
|
||||
my ($tree, %mod_map) = @_;
|
||||
my ($ci,$result,$lastlog,$rev,$begin_tag,$end_tag);
|
||||
my $have_mod_map;
|
||||
my @bind_values;
|
||||
@@ -90,7 +59,7 @@ sub query_checkins {
|
||||
$::query_module = 'all' unless defined $::query_module;
|
||||
if( $::query_module ne 'all' && $::query_module ne 'allrepositories' && @::query_dirs == 0 ){
|
||||
$have_mod_map = 1;
|
||||
%mod_map = &get_module_map( $::query_module );
|
||||
%mod_map = get_module_map( $::query_module );
|
||||
}
|
||||
else {
|
||||
$have_mod_map = 0;
|
||||
@@ -122,7 +91,7 @@ sub query_checkins {
|
||||
|
||||
$result = [];
|
||||
|
||||
&ConnectToDatabase();
|
||||
ConnectToDatabase($tree);
|
||||
|
||||
my $qstring = "SELECT type, UNIX_TIMESTAMP(ci_when), people.who, " .
|
||||
"repositories.repository, dirs.dir, files.file, revision, " .
|
||||
@@ -139,11 +108,11 @@ sub query_checkins {
|
||||
|
||||
if ($::query_date_min) {
|
||||
$qstring .= " AND ci_when >= ?";
|
||||
push(@bind_values, &formatSqlTime($::query_date_min));
|
||||
push(@bind_values, formatSqlTime($::query_date_min));
|
||||
}
|
||||
if ($::query_date_max) {
|
||||
$qstring .= " AND ci_when <= ?";
|
||||
push(@bind_values, &formatSqlTime($::query_date_max));
|
||||
push(@bind_values, formatSqlTime($::query_date_max));
|
||||
}
|
||||
if ($::query_branch_head) {
|
||||
$qstring .= " AND branches.branch = ''";
|
||||
@@ -212,10 +181,10 @@ sub query_checkins {
|
||||
}
|
||||
|
||||
if ($::query_debug) {
|
||||
print "<pre wrap> Query: " . &html_quote($qstring) . "\n";
|
||||
print "<pre wrap> Query: " . value_encode($qstring) . "\n";
|
||||
print "With values:\n";
|
||||
foreach my $v (@bind_values) {
|
||||
print "\t" . &html_quote($v) . "\n";
|
||||
print "\t" . value_encode($v) . "\n";
|
||||
}
|
||||
print "\nTreeID is $::TreeID\n";
|
||||
if ($have_mod_map) {
|
||||
@@ -232,7 +201,7 @@ sub query_checkins {
|
||||
print "</pre>\n";
|
||||
}
|
||||
|
||||
&SendSQL($qstring, @bind_values);
|
||||
SendSQL($qstring, @bind_values);
|
||||
|
||||
$lastlog = 0;
|
||||
my @row;
|
||||
@@ -291,6 +260,205 @@ sub query_checkins {
|
||||
return $result;
|
||||
}
|
||||
|
||||
# ViewVC query function
|
||||
sub query_checkins_viewvc($) {
|
||||
my ($tree) = @_;
|
||||
my @bind_values;
|
||||
my $currentquery;
|
||||
|
||||
ConnectToDatabase($tree);
|
||||
|
||||
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 (defined($::query_module) && $::query_module ne 'allrepositories') {
|
||||
$qstring .= " AND repositories.repository = ?";
|
||||
push(@bind_values, $::query_module);
|
||||
}
|
||||
|
||||
if (defined($::query_date_min) && $::query_date_min) {
|
||||
$qstring .= " AND ci_when >= ?";
|
||||
push(@bind_values, formatSqlTime($::query_date_min));
|
||||
}
|
||||
if (defined($::query_date_max) && $::query_date_max) {
|
||||
$qstring .= " AND ci_when <= ?";
|
||||
push(@bind_values, formatSqlTime($::query_date_max));
|
||||
}
|
||||
|
||||
if ($::query_branch_head) {
|
||||
$qstring .= " AND branches.branch = ''";
|
||||
} elsif ($::query_branch ne '') {
|
||||
if ($::query_branchtype eq 'regexp') {
|
||||
$qstring .= " AND branches.branch REGEXP ?";
|
||||
push(@bind_values, $::query_branch);
|
||||
} elsif ($::query_branchtype eq 'notregexp') {
|
||||
if ($::query_branch eq 'HEAD') {
|
||||
$qstring .= " AND branches.branch != ''";
|
||||
} else {
|
||||
$qstring .= " and not (branches.branch REGEXP ?)";
|
||||
push(@bind_values, $::query_branch);
|
||||
}
|
||||
} else {
|
||||
$qstring .=
|
||||
" AND (branches.branch = ? OR branches.branch = ?)";
|
||||
push(@bind_values, $::query_branch);
|
||||
push(@bind_values, "T$::query_branch");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# print "Query: $qstring\n";
|
||||
# print "values: @bind_values\n";
|
||||
SendSQL(\$currentquery, $qstring, @bind_values);
|
||||
|
||||
my $lastlog = 0;
|
||||
my (@row, $ci, $rev, $result);
|
||||
while (@row = FetchSQLData(\$currentquery)) {
|
||||
#print "<pre>";
|
||||
$ci = [];
|
||||
for (my $i=0 ; $i<=$::CI_LOG ; $i++) {
|
||||
if ($i == $::CI_DATE) {
|
||||
$ci->[$i] = GMTtoLocaltime($row[$i]);
|
||||
} else {
|
||||
$ci->[$i] = $row[$i];
|
||||
}
|
||||
}
|
||||
#print "</pre>\n";
|
||||
|
||||
|
||||
my $key = "$ci->[$::CI_DIR]/$ci->[$::CI_FILE]";
|
||||
# if (IsHidden("$ci->[$::CI_REPOSITORY]/$key")) {
|
||||
# next;
|
||||
# }
|
||||
|
||||
next if ($key =~ m@^CVSROOT/@);
|
||||
|
||||
if (defined($::query_logexpr) &&
|
||||
$::query_logexpr ne '' &&
|
||||
!($ci->[$::CI_LOG] =~ /$::query_logexpr/i) ){
|
||||
next;
|
||||
}
|
||||
|
||||
push( @$result, $ci );
|
||||
}
|
||||
|
||||
DisconnectFromDatabase();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
#
|
||||
# Common helper functions
|
||||
#
|
||||
sub ConnectToDatabase($) {
|
||||
my ($tree) = @_;
|
||||
my $use_bonsai = $::global_treedata->{$tree}->{use_bonsai};
|
||||
my $use_viewvc = $::global_treedata->{$tree}->{use_viewvc};
|
||||
|
||||
if (!defined $db) {
|
||||
my ($dsn, $dbdriver, $dbname, $dbhost, $dbport, $dbuser, $dbpasswd);
|
||||
|
||||
if ($use_viewvc) {
|
||||
$dbdriver = $::global_treedata->{$tree}->{viewvc_dbdriver};
|
||||
$dbname = $::global_treedata->{$tree}->{viewvc_dbname};
|
||||
$dbhost = $::global_treedata->{$tree}->{viewvc_dbhost};
|
||||
$dbport = $::global_treedata->{$tree}->{viewvc_dbport};
|
||||
$dbuser = $::global_treedata->{$tree}->{viewvc_dbuser};
|
||||
$dbpasswd = $::global_treedata->{$tree}->{viewvc_dbpasswd};
|
||||
} elsif ($use_bonsai) {
|
||||
$dbdriver = $::global_treedata->{$tree}->{bonsai_dbdriver};
|
||||
$dbname = $::global_treedata->{$tree}->{bonsai_dbname};
|
||||
$dbhost = $::global_treedata->{$tree}->{bonsai_dbhost};
|
||||
$dbport = $::global_treedata->{$tree}->{bonsai_dbport};
|
||||
$dbuser = $::global_treedata->{$tree}->{bonsai_dbuser};
|
||||
$dbpasswd = $::global_treedata->{$tree}->{bonsai_dbpasswd};
|
||||
} else {
|
||||
# Error
|
||||
die("Cannot determine query system!");
|
||||
return;
|
||||
}
|
||||
|
||||
$dsn = "DBI:${dbdriver}:database=${dbname};";
|
||||
$dsn .= "host=${dbhost};"
|
||||
if (defined($dbhost) && "$dbhost" ne "");
|
||||
$dsn .= "port=${dbport};"
|
||||
if (defined($dbport) && "$dbport" ne "");
|
||||
|
||||
$db = DBI->connect($dsn, $dbuser, $dbpasswd)
|
||||
|| die "Can't connect to database server.";
|
||||
}
|
||||
}
|
||||
|
||||
sub DisconnectFromDatabase {
|
||||
if (defined $db) {
|
||||
$db->disconnect();
|
||||
undef $db;
|
||||
}
|
||||
}
|
||||
|
||||
sub SendSQL {
|
||||
my ($query_ref, $str, @bind_values) = (@_);
|
||||
my $status = 0;
|
||||
|
||||
$$query_ref = $db->prepare($str) || $status++;
|
||||
if ($status) {
|
||||
print STDERR "SendSQL prepare error: '$str' with values (";
|
||||
foreach my $v (@bind_values) {
|
||||
print STDERR "'" . &shell_escape($v) . "', ";
|
||||
}
|
||||
print STDERR ") :: " . $db->errstr . "\n";
|
||||
die "Cannot prepare SQL query. Please contact system administrator.\n";
|
||||
}
|
||||
|
||||
$$query_ref->execute(@bind_values) || $status++;
|
||||
if ($status) {
|
||||
print STDERR "SendSQL execute error: '$str' with values (";
|
||||
foreach my $v (@bind_values) {
|
||||
print STDERR "'" . &shell_escape($v) . "', ";
|
||||
}
|
||||
print STDERR ") :: " . $$query_ref->errstr . "\n";
|
||||
die "Cannot execute SQL query. Please contact system administrator.\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub FetchSQLData($) {
|
||||
my ($query_ref) = (@_);
|
||||
return $$query_ref->fetchrow_array();
|
||||
}
|
||||
|
||||
|
||||
sub FetchOneColumn($) {
|
||||
my ($query_ref) = @_;
|
||||
my @row = &FetchSQLData($query_ref);
|
||||
return $row[0];
|
||||
}
|
||||
|
||||
sub formatSqlTime {
|
||||
my ($date) = @_;
|
||||
my $time = strftime("%Y/%m/%d %T", gmtime($date));
|
||||
return $time;
|
||||
}
|
||||
|
||||
# Use this function to workaround the fact that perl
|
||||
# assumes that seconds since epoch are always in localtime
|
||||
sub GMTtoLocaltime() {
|
||||
my ($time) = @_;
|
||||
my @timeData = localtime(time);
|
||||
my $diff = mktime(gmtime($time)) - mktime(localtime($time));
|
||||
# Account for DST
|
||||
$diff -= 3600 if ($timeData[8]);
|
||||
return $time - $diff;
|
||||
}
|
||||
|
||||
#
|
||||
# Bonsai helper functions
|
||||
#
|
||||
|
||||
sub load_tag {
|
||||
my ($tagname) = @_;
|
||||
|
||||
@@ -345,7 +513,7 @@ print "<br>Added ($file,$version) for tag $tagname<br>\n";
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
# Common helper functions
|
||||
|
||||
sub rev_is_after {
|
||||
my $r1 = shift @_;
|
||||
@@ -465,3 +633,4 @@ sub build_map {
|
||||
return $bFound;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -411,6 +411,20 @@ sub value_encode {
|
||||
return $s;
|
||||
}
|
||||
|
||||
# Quotify a string, suitable for output as form values
|
||||
sub value_quote {
|
||||
my ($var) = (@_);
|
||||
|
||||
return "" if (!defined($var));
|
||||
$var =~ s/\&/\&/g;
|
||||
$var =~ s/</\</g;
|
||||
$var =~ s/>/\>/g;
|
||||
$var =~ s/\"/\"/g;
|
||||
$var =~ s/\n/\
/g;
|
||||
$var =~ s/\r/\
/g;
|
||||
return $var;
|
||||
}
|
||||
|
||||
# Only allow characters suitable for invoking a shell process
|
||||
sub shell_escape {
|
||||
my ($file) = @_;
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
|
||||
#
|
||||
# These generic DBI routines should live somewhere common
|
||||
#
|
||||
|
||||
use strict;
|
||||
use DBI;
|
||||
use POSIX qw(strftime mktime);
|
||||
use Time::Local;
|
||||
|
||||
# Assume that treedata.pl & tbglobals.pl are already loaded
|
||||
my $db = undef;
|
||||
|
||||
sub ConnectToDatabase($) {
|
||||
my ($tree) = @_;
|
||||
my $use_bonsai = $::global_treedata->{$tree}->{use_bonsai};
|
||||
my $use_viewvc = $::global_treedata->{$tree}->{use_viewvc};
|
||||
|
||||
if (!defined $db) {
|
||||
my ($dsn, $dbdriver, $dbname, $dbhost, $dbport, $dbuser, $dbpasswd);
|
||||
|
||||
if ($use_viewvc) {
|
||||
$dbdriver = $::global_treedata->{$tree}->{viewvc_dbdriver};
|
||||
$dbname = $::global_treedata->{$tree}->{viewvc_dbname};
|
||||
$dbhost = $::global_treedata->{$tree}->{viewvc_dbhost};
|
||||
$dbport = $::global_treedata->{$tree}->{viewvc_dbport};
|
||||
$dbuser = $::global_treedata->{$tree}->{viewvc_dbuser};
|
||||
$dbpasswd = $::global_treedata->{$tree}->{viewvc_dbpasswd};
|
||||
} elsif ($use_bonsai) {
|
||||
$dbdriver = $::global_treedata->{$tree}->{bonsai_dbdriver};
|
||||
$dbname = $::global_treedata->{$tree}->{bonsai_dbname};
|
||||
$dbhost = $::global_treedata->{$tree}->{bonsai_dbhost};
|
||||
$dbport = $::global_treedata->{$tree}->{bonsai_dbport};
|
||||
$dbuser = $::global_treedata->{$tree}->{bonsai_dbuser};
|
||||
$dbpasswd = $::global_treedata->{$tree}->{bonsai_dbpasswd};
|
||||
} else {
|
||||
# Error
|
||||
die("Cannot determine query system!");
|
||||
return;
|
||||
}
|
||||
|
||||
$dsn = "DBI:${dbdriver}:database=${dbname};";
|
||||
$dsn .= "host=${dbhost};"
|
||||
if (defined($dbhost) && "$dbhost" ne "");
|
||||
$dsn .= "port=${dbport};"
|
||||
if (defined($dbport) && "$dbport" ne "");
|
||||
|
||||
$db = DBI->connect($dsn, $dbuser, $dbpasswd)
|
||||
|| die "Can't connect to database server.";
|
||||
}
|
||||
}
|
||||
|
||||
sub DisconnectFromDatabase {
|
||||
if (defined $db) {
|
||||
$db->disconnect();
|
||||
undef $db;
|
||||
}
|
||||
}
|
||||
|
||||
sub SendSQL {
|
||||
my ($query_ref, $str, @bind_values) = (@_);
|
||||
my $status = 0;
|
||||
|
||||
$$query_ref = $db->prepare($str) || $status++;
|
||||
if ($status) {
|
||||
print STDERR "SendSQL prepare error: '$str' with values (";
|
||||
foreach my $v (@bind_values) {
|
||||
print STDERR "'" . &shell_escape($v) . "', ";
|
||||
}
|
||||
print STDERR ") :: " . $db->errstr . "\n";
|
||||
die "Cannot prepare SQL query. Please contact system administrator.\n";
|
||||
}
|
||||
|
||||
$$query_ref->execute(@bind_values) || $status++;
|
||||
if ($status) {
|
||||
print STDERR "SendSQL execute error: '$str' with values (";
|
||||
foreach my $v (@bind_values) {
|
||||
print STDERR "'" . &shell_escape($v) . "', ";
|
||||
}
|
||||
print STDERR ") :: " . $$query_ref->errstr . "\n";
|
||||
die "Cannot execute SQL query. Please contact system administrator.\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub FetchSQLData($) {
|
||||
my ($query_ref) = (@_);
|
||||
return $$query_ref->fetchrow_array();
|
||||
}
|
||||
|
||||
|
||||
sub FetchOneColumn($) {
|
||||
my ($query_ref) = @_;
|
||||
my @row = &FetchSQLData($query_ref);
|
||||
return $row[0];
|
||||
}
|
||||
|
||||
sub formatSqlTime {
|
||||
my ($date) = @_;
|
||||
my $time = strftime("%Y/%m/%d %T", gmtime($date));
|
||||
return $time;
|
||||
}
|
||||
|
||||
# Use this function to workaround the fact that perl
|
||||
# assumes that seconds since epoch are always in localtime
|
||||
sub GMTtoLocaltime() {
|
||||
my ($time) = @_;
|
||||
my @timeData = localtime(time);
|
||||
my $diff = mktime(gmtime($time)) - mktime(localtime($time));
|
||||
# Account for DST
|
||||
$diff -= 3600 if ($timeData[8]);
|
||||
return $time - $diff;
|
||||
}
|
||||
|
||||
#
|
||||
# ViewVC uses the same table layout as bonsai. Yippie!
|
||||
#
|
||||
|
||||
sub query_checkins($) {
|
||||
my ($tree, %mod_map) = @_;
|
||||
my @bind_values;
|
||||
my $currentquery;
|
||||
|
||||
&ConnectToDatabase($tree);
|
||||
|
||||
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 (defined($::query_module) && $::query_module ne 'allrepositories') {
|
||||
$qstring .= " AND repositories.repository = ?";
|
||||
push(@bind_values, $::query_module);
|
||||
}
|
||||
|
||||
if (defined($::query_date_min) && $::query_date_min) {
|
||||
$qstring .= " AND ci_when >= ?";
|
||||
push(@bind_values, &formatSqlTime($::query_date_min));
|
||||
}
|
||||
if (defined($::query_date_max) && $::query_date_max) {
|
||||
$qstring .= " AND ci_when <= ?";
|
||||
push(@bind_values, &formatSqlTime($::query_date_max));
|
||||
}
|
||||
|
||||
if ($::query_branch_head) {
|
||||
$qstring .= " AND branches.branch = ''";
|
||||
} elsif ($::query_branch ne '') {
|
||||
if ($::query_branchtype eq 'regexp') {
|
||||
$qstring .= " AND branches.branch REGEXP ?";
|
||||
push(@bind_values, $::query_branch);
|
||||
} elsif ($::query_branchtype eq 'notregexp') {
|
||||
if ($::query_branch eq 'HEAD') {
|
||||
$qstring .= " AND branches.branch != ''";
|
||||
} else {
|
||||
$qstring .= " and not (branches.branch REGEXP ?)";
|
||||
push(@bind_values, $::query_branch);
|
||||
}
|
||||
} else {
|
||||
$qstring .=
|
||||
" AND (branches.branch = ? OR branches.branch = ?)";
|
||||
push(@bind_values, $::query_branch);
|
||||
push(@bind_values, "T$::query_branch");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# print "Query: $qstring\n";
|
||||
# print "values: @bind_values\n";
|
||||
&SendSQL(\$currentquery, $qstring, @bind_values);
|
||||
|
||||
my $lastlog = 0;
|
||||
my (@row, $ci, $rev, $result);
|
||||
while (@row = &FetchSQLData(\$currentquery)) {
|
||||
#print "<pre>";
|
||||
$ci = [];
|
||||
for (my $i=0 ; $i<=$::CI_LOG ; $i++) {
|
||||
if ($i == $::CI_DATE) {
|
||||
$ci->[$i] = &GMTtoLocaltime($row[$i]);
|
||||
} else {
|
||||
$ci->[$i] = $row[$i];
|
||||
}
|
||||
}
|
||||
#print "</pre>\n";
|
||||
|
||||
|
||||
my $key = "$ci->[$::CI_DIR]/$ci->[$::CI_FILE]";
|
||||
# if (IsHidden("$ci->[$::CI_REPOSITORY]/$key")) {
|
||||
# next;
|
||||
# }
|
||||
|
||||
next if ($key =~ m@^CVSROOT/@);
|
||||
|
||||
if (defined($::query_logexpr) &&
|
||||
$::query_logexpr ne '' &&
|
||||
!($ci->[$::CI_LOG] =~ /$::query_logexpr/i) ){
|
||||
next;
|
||||
}
|
||||
|
||||
push( @$result, $ci );
|
||||
}
|
||||
|
||||
&DisconnectFromDatabase();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user