1999-10-18 22:55:01 +00:00
#!/usr/bonsaitools/bin/perl -w
1998-06-16 21:43:24 +00:00
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
1999-11-01 23:33:56 +00:00
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (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/
1998-06-16 21:43:24 +00:00
#
1999-11-01 23:33:56 +00:00
# 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.
1998-06-16 21:43:24 +00:00
#
# The Original Code is the Bonsai CVS tool.
#
# The Initial Developer of the Original Code is Netscape Communications
1999-11-01 23:33:56 +00:00
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
1998-06-16 21:43:24 +00:00
1999-10-18 22:55:01 +00:00
use diagnostics;
use strict;
1999-07-23 18:39:31 +00:00
require 'CGI.pl';
1998-06-16 21:43:24 +00:00
1999-07-23 18:39:31 +00:00
my $file= $::FORM{'file'};
my $mark= $::FORM{'mark'};
my $ln = ($mark > 10 ? $mark-10 : 1 );
my $rev = $::FORM{'rev'};
my $debug = $::FORM{'debug'};
1998-06-16 21:43:24 +00:00
print "Content-Type: text/html\n\n";
1999-07-23 18:39:31 +00:00
my $CVS_ROOT = $::FORM{'root'};
2000-03-30 05:17:55 +00:00
if( !defined($CVS_ROOT) || $CVS_ROOT eq '' ){
1998-06-16 21:43:24 +00:00
$CVS_ROOT = pickDefaultRepository();
}
validateRepository($CVS_ROOT);
1999-07-23 18:39:31 +00:00
my $CVS_REPOS_SUFIX = $CVS_ROOT;
1998-06-16 21:43:24 +00:00
$CVS_REPOS_SUFIX =~ s/\//_/g;
1999-07-23 18:39:31 +00:00
ConnectToDatabase();
1998-06-16 21:43:24 +00:00
1999-07-23 18:39:31 +00:00
my $f = SqlQuote($file);
1999-10-18 22:55:01 +00:00
my $qstring = "select distinct dirs.dir from checkins,dirs,files,repositories where dirs.id=dirid and files.id=fileid and repositories.id=repositoryid and repositories.repository='$CVS_ROOT' and files.file=$f order by dirs.dir";
1998-06-16 21:43:24 +00:00
if ($debug) {
print "<pre wrap>$qstring</pre>\n";
}
1999-07-23 18:39:31 +00:00
my (@row, $d, @fl, $s);
1998-06-16 21:43:24 +00:00
1999-07-23 18:39:31 +00:00
SendSQL($qstring);
while(@row = FetchSQLData()){
1998-06-16 21:43:24 +00:00
$d = $row[0];
push @fl, "$d/$file";
}
if( @fl == 0 ){
print "<h3>No files matched this file name. It may have been added recently.</h3>";
}
elsif( @fl == 1 ){
$s = $fl[0];
print "<head>
<meta http-equiv=Refresh
content=\"0; URL=cvsblame.cgi?file=$s&rev=$rev&root=$CVS_ROOT&mark=$mark#$ln\">
</head>
";
}
else {
print "<h3>Pick the file that best matches the one you are looking for:</h3>\n";
for $s (@fl) {
print "<dt><a href=cvsblame.cgi?file=$s&rev=$rev&mark=$mark#$ln>$s</a>";
}
}