Bug 121636 - Provide support for cvsgraph (requires the cvsgraph binary, see bug 121636 for more information).

r= kiko
This commit is contained in:
jake%acutex.net 2002-02-01 14:32:55 +00:00
Родитель 580f85ab56
Коммит e193dc9fd4
9 изменённых файлов: 396 добавлений и 1 удалений

Просмотреть файл

@ -38,6 +38,7 @@ CVS=@CVS@
RLOG=@RLOG@
CO=@CO@
RCSDIFF=@RCSDIFF@
CVSGRAPH=@CVSGRAPH@
FILES = CGI.pl \
SourceChecker.cgi \
@ -55,6 +56,7 @@ FILES = CGI.pl \
cvsblame.cgi \
cvsblame.pl \
cvsguess.cgi \
cvsgraph.cgi \
cvsindex.pl \
cvslog.cgi \
cvsmenu.pl \
@ -113,6 +115,7 @@ params: params.in
-e s#_RLOG_#$(RLOG)#g \
-e s#_CO_#$(CO)#g \
-e s#_RCSDIFF_#$(RCSDIFF)#g \
-e s#_CVSGRAPH_#$(CVSGRAPH)#g \
$< >$@
install: all
@ -142,6 +145,18 @@ install: all
echo ; \
echo "Not replacing existing params" ; \
fi
@if test ! -r $(PREFIX)/data/cvsgraph.conf ; then \
echo "Installing cvsgraph.conf" && \
cp cvsgraph.conf $(PREFIX)/data ; \
else \
echo ; \
echo "Not replacing existing cvsgraph.conf" ; \
fi
@echo
@echo "If you are updating an existing install, be sure to check"
@echo "editparams.cgi to see if there are any new things you should"
@echo "configure as this script will not overwrite your existing"
@echo "params file"
@echo
@echo "If you are installing a new Bonsai (not upgrading), you should"
@echo "run maketables.sh to create database tables, then customize the"

31
webtools/bonsai/configure поставляемый
Просмотреть файл

@ -871,6 +871,36 @@ else
echo "$ac_t""no" 1>&6
fi
# Extract the first word of "cvsgraph", so it can be a program name with args.
set dummy cvsgraph; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:847: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_CVSGRAPH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
case "$CVSGRAPH" in
/*)
ac_cv_path_CVSGRAPH="$CVSGRAPH" # Let the user override the test with a path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_CVSGRAPH="$ac_dir/$ac_word"
break
fi
done
IFS="$ac_save_ifs"
;;
esac
fi
CVSGRAPH="$ac_cv_path_CVSGRAPH"
if test -n "$CVSGRAPH"; then
echo "$ac_t""$CVSGRAPH" 1>&6
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
@ -1072,6 +1102,7 @@ s%@CO@%$CO%g
s%@CVS@%$CVS%g
s%@RLOG@%$RLOG%g
s%@RCSDIFF@%$RCSDIFF%g
s%@CVSGRAPH@%$CVSGRAPH%g
CEOF
EOF

Просмотреть файл

@ -247,6 +247,13 @@ foreach my $path (split('/',$rcs_path)) {
my $lxr_path = Fix_LxrLink("$link_path$file_tail");
print "<A HREF='$lxr_path'>$file_tail</a> ";
my $graph_cell = Param('cvsgraph') ? <<"--endquote--" : "";
</TR><TR>
<TD NOWRAP>
<A HREF="cvsgraph.cgi?file=$filename">Revision Graph</A>
</TD>
--endquote--
print " (<A HREF='cvsblame.cgi?file=$filename&rev=$revision&root=$root'";
print " onmouseover='return log(event,\"$::prev_revision{$revision}\",\"$revision\");'" if $use_layers;
print " onmouseover=\"showMessage('$revision','top')\" id=\"line_top\"" if $use_dom;
@ -271,6 +278,7 @@ print qq(
<TD NOWRAP>
<A HREF="cvslog.cgi?file=$filename">Full Change Log</A>
</TD>
$graph_cell
</TR>
</TABLE>
</TD>

135
webtools/bonsai/cvsgraph.cgi Executable file
Просмотреть файл

@ -0,0 +1,135 @@
#!/usr/bonsaitools/bin/perl -w
# cvsgraph.cgi -- a graph of all branchs, tags, etc.
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla 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/MPL/
#
# 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 Jacob Steenhagen
#
# Contributor(s): Jacob Steenhagen <jake@acutex.net>
use diagnostics;
use strict;
require 'CGI.pl';
# This cgi doesn't actually generate a graph. It relies on the cvsgraph
# program found at http://www.akhphd.au.dk/~bertho/cvsgraph/
# File locations can be set at in the editparams.cgi page.
sub print_top {
my ($title) = @_;
$title ||= "Error";
print "Content-type: text/html\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
print "<html>\n<head>\n";
print " <title>$title</title>\n";
print "</head>\n<body>\n";
}
sub print_bottom {
print "</body>\n</html>\n";
}
sub print_usage {
&print_top;
print "This script requires a filename.\n";
&print_bottom;
}
### Live code below
unless (Param('cvsgraph')) {
&print_top;
print "CVS Graph is not currently configured for this installation\n";
&print_bottom;
exit;
}
my @src_roots = getRepositoryList();
# Handle the "file" argument
#
my $filename = '';
$filename = $::FORM{file} if defined $::FORM{file};
if ($filename eq '') {
&print_usage;
exit;
}
my ($file_head, $file_tail) = $filename =~ m@(.*/)?(.+)@;
# Handle the "root" argument
#
my $root = $::FORM{root};
if (defined $root and $root ne '') {
$root =~ s|/$||;
validateRepository($root);
if (-d $root) {
unshift(@src_roots, $root);
} else {
&print_top;
print "Error: Root, $root, is not a directory.<BR><BR>\n";
&print_bottom;
exit;
}
}
# Find the rcs file
#
my $rcs_filename;
my $found_rcs_file = 0;
foreach (@src_roots) {
$root = $_;
$rcs_filename = "$root/$filename,v";
$rcs_filename = Fix_BonsaiLink($rcs_filename);
$found_rcs_file = 1, last if -r $rcs_filename;
$rcs_filename = "$root/${file_head}Attic/$file_tail,v";
$found_rcs_file = 1, last if -r $rcs_filename;
}
unless ($found_rcs_file) {
&print_top;
print "Rcs file, $filename, does not exist.\n";
print "<pre>rcs_filename => '$rcs_filename'\nroot => '$root'</pre>\n";
&print_bottom;
exit;
}
# Hack these variables up the way that the cvsgraph executable wants them
$rcs_filename =~ s:^$root/::;
my $conf = $0;
$conf =~ s:[^/\\]+$::;
$conf .= "data/cvsgraph.conf";
my @cvsgraph_cmd = (Param("cvsgraph"),
"-c", $conf,
"-r", $root);
if (defined $::FORM{'image'}) {
print "Content-type: image/png\n\n";
}
else {
push(@cvsgraph_cmd, "-i", "-M", "revmap"); # Include args to make map
&print_top("CVS Graph for " . $file_tail);
}
system(@cvsgraph_cmd, $rcs_filename);
if (!defined $::FORM{'image'}) {
print qq{<img src="cvsgraph.cgi?file=$::FORM{'file'}&image=1" };
print qq{usemap="#revmap" alt="$filename" border="0">};
&print_bottom;
}

Просмотреть файл

@ -0,0 +1,181 @@
# CvsGraph configuration
#
# - Empty lines and whitespace are ignored.
#
# - Comments start with '#' and everything until
# end of line is ignored.
#
# - Strings are C-style strings in which characters
# may be escaped with '\' and written in octal
# and hex escapes. Note that '\' must be escaped
# if it is to be entered as a character.
#
# - Some strings are expanded with printf like
# conversions which start with '%'. Not all
# are applicable at all times, in which case they
# will expand to noting.
# %c = cvsroot (with trailing '/')
# %C = cvsroot (*without* trailing '/')
# %m = module (with trailing '/')
# %M = module (*without* trailing '/')
# %f = filename without path
# %F = filename without path and with ",v" stripped
# %p = path part of filename (with trailing '/')
# %r = number of revisions
# %b = number of branches
# %% = '%'
# %R = the revision number (e.g. '1.2.4.4')
# %P = previous revision number
# %B = the branch number (e.g. '1.2.4')
# %d = date of revision
# %a = author of revision
# %s = state of revision
# %t = current tag of branch or revision
# %0..%9 = command-line argument -0 .. -9
#
# - Numbers may be entered as octal, decimal or
# hex as in 0117, 79 and 0x4f respectively.
#
# - Fonts are numbered 0..4 (defined as in libgd)
# 0 = tiny
# 1 = small
# 2 = medium (bold)
# 3 = large
# 4 = giant
#
# - Colors are a string like html-type colors in
# the form "#rrggbb" with parts written in hex
# rr = red (00..ff)
# gg = green (00-ff)
# bb = blue (00-ff)
#
# - There are several reserved words besides of the
# feature-keywords. These additional reserved words
# expand to numerical values:
# * false = 0
# * true = 1
# * left = 0
# * center = 1
# * right = 2
# * gif = 0
# * png = 1
# * jpeg = 2
# * tiny = 0
# * small = 1
# * medium = 2
# * large = 3
# * giant = 4
# cvsroot <string>
# The *absolute* base directory where the
# CSV/RCS repository can be found
# cvsmodule <string>
#
#cvsroot = "/cvsroot";
#cvsmodule = "";
# color_bg <color>
# The background color of the image
color_bg = "#ffffff";
# date_format <string>
# The strftime(3) format string for date and time
date_format = "%d-%b-%Y %H:%M:%S";
box_shadow = true;
tag_font = medium;
tag_color = "#007000";
rev_font = giant;
rev_color = "#000000";
rev_bgcolor = "#f0f0f0";
rev_separator = 1;
rev_minline = 15;
rev_maxline = 30;
rev_lspace = 5;
rev_rspace = 5;
rev_tspace = 3;
rev_bspace = 3;
rev_text = "%d\n%a"; # or "%d\n%a, %s" for author and state too
rev_text_font = tiny;
rev_text_color = "#500020";
# branch_font <number>
# The font of the number and tags
# branch_color <color>
# All branch element's color
# branch_[lrtb]space <number>
# Interior spacing (margin)
# branch_margin <number>
# Exterior spacing
# branch_connect <number>
# Length of the vertical connector
branch_font = medium;
branch_color = "#0000c0";
branch_bgcolor = "#ffffc0";
branch_lspace = 5;
branch_rspace = 5;
branch_tspace = 3;
branch_bspace = 3;
branch_margin = 15;
branch_connect = 8;
# title <string>
# The title string is expanded (see above for details)
# title_[xy] <number>
# Postion of title
# title_font <number>
# The font
# title_align <number>
# 0 = left
# 1 = center
# 2 = right
# title_color <color>
title = "%m%f\nRevisions: %r, Branches: %b";
title_x = 10;
title_y = 5;
title_font = small;
title_align = left;
title_color = "#800000";
# Margins of the image
# Note: the title is outside the margin
margin_top = 35;
margin_bottom = 10;
margin_left = 10;
margin_right = 10;
# Image format(s)
# image_type <number|{gif,jpeg,png}>
# gif (0) = Create gif image
# png (1) = Create png image
# jpeg (2) = Create jpeg image
# Image types are available if they can be found in
# the gd library. Newer versions of gd do not have
# gif anymore. CvsGraph will automatically generate
# png images instead.
# image_quality <number>
# The quality of a jpeg image (1..100)
image_type = png;
image_quality = 75;
# HTML ImageMap generation
# map_name <string>
# The name= attribute in <map name="mapname">...</map>
# map_branch_href <string>
# map_branch_alt <string>
# map_rev_href <string>
# map_rev_alt <string>
# map_diff_href <string>
# map_diff_alt <string>
# These are the href= and alt= attributes in the <area>
# tags of html. The strings are expanded (see above).
map_name = "revmap";
map_branch_href = "href=\"cvslog.cgi?file=%p%F&rev=%t\"";
map_branch_alt = "alt=\"%t\" %2";
map_rev_href = "href=\"cvsblame.cgi?file=%p%F&rev=%R\"";
map_rev_alt = "alt=\"%a\" %3";
map_diff_href = "href=\"%9cvsview2.cgi?diff_mode=context&whitespace_mode=show&file=%F&subdir=%p&command=DIFF_FRAMESET&rev1=%P&rev2=%R\"";
map_diff_alt = "alt=\"%P &lt;-&gt; %R\" %4";

Просмотреть файл

@ -74,7 +74,7 @@ my ($file_head, $file_tail) = $filename =~ m@(.*/)?(.+)@;
# Handle the "rev" argument
#
$::opt_rev = "";
$::opt_rev = $::FORM{'rev'} if defined($::FORM{'rev'} && $::FORM{'rev'} ne 'HEAD');
$::opt_rev = $::FORM{'rev'} if defined $::FORM{'rev'} && $::FORM{'rev'} !~ m/^(HEAD|MAIN)$/;
my $browse_revtag = 'HEAD';
$browse_revtag = $::opt_rev if ($::opt_rev =~ /[A-Za-z]/);
my $revision = '';
@ -182,6 +182,15 @@ foreach my $path (split('/',$rcs_path)) {
$lxr_path = Fix_LxrLink("$link_path$file_tail");
print "<A HREF='$lxr_path'>$file_tail</a> ";
my $graph_cell = Param('cvsgraph') ? <<"--endquote--" : "";
</TR><TR>
<TD>
<A HREF="cvsgraph.cgi?file=$filename">graph</A>&nbsp;
</TD><TD NOWRAP>
View the revision history as a graph
</TD>
--endquote--
print " (";
print "$browse_revtag:" unless $browse_revtag eq 'HEAD';
print $revision if $revision;
@ -214,6 +223,7 @@ print qq(
</TD><TD NOWRAP>
Annotate the author of each line.
</TD>
$graph_cell
</TR>
</TABLE>
</TD>

Просмотреть файл

@ -512,6 +512,10 @@ sub do_diff_links {
$blame_link .= "&root=$opt_root" if defined($opt_root);
my $diff_link = "$magic_url&command=DIRECTORY&file=$opt_file&rev1=$opt_rev1&rev2=$opt_rev2";
$diff_link .= "&root=$opt_root" if defined($opt_root);
my $graph_row = Param('cvsgraph') ? <<"--endquote--" : "";
<TR><TD NOWRAP ALIGN=RIGHT VALIGN=TOP><A HREF="cvsgraph.cgi?file=$opt_subdir/$opt_file" TARGET="_top"><B>graph:</B></A></TD>
<TD NOWRAP>View the revision tree as a graph</TD></TR>
--endquote--
print "<TD NOWRAP ALIGN=LEFT VALIGN=CENTER>";
print "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>";
@ -521,6 +525,7 @@ sub do_diff_links {
print "<TD NOWRAP>Annotate line authors.</TD></TR>\n";
print "<TR><TD NOWRAP ALIGN=RIGHT VALIGN=TOP><A HREF=\"$lxr_link\" TARGET=_top><B>lxr:</B></A> </TD>";
print "<TD NOWRAP>Browse source as hypertext.</TD></TR>\n";
print $graph_row;
print "</TABLE>";
print "</TD>";

Просмотреть файл

@ -214,6 +214,15 @@ DefParam("cocommand",
"t",
'/usr/bin/co');
DefParam("cvsgraph",
"cvsgraph is an application that will output, in the form of a
graphic, every branch, tag, and revision that exists for a file. It requires
that the <a href=\"http://www.akhphd.au.dk/~bertho/cvsgraph/\">cvsgraph
executable</a> be installed on this system. If you don't wish to use
cvsgraph, leave this param blank.",
"t",
"");
##
## Things that we link to on the fly

Просмотреть файл

@ -2,4 +2,5 @@ $::param{'cocommand'} = '_CO_';
$::param{'cvscommand'} = '_CVS_';
$::param{'rcsdiffcommand'} = '_RCSDIFF_';
$::param{'rlogcommand'} = '_RLOG_';
$::param{'cvsgraph'} = '_CVSGRAPH_';
1;