diff --git a/webtools/lxr/lib/LXR/Common.pm b/webtools/lxr/lib/LXR/Common.pm index adfb48baa472..2d8ce4099a8c 100755 --- a/webtools/lxr/lib/LXR/Common.pm +++ b/webtools/lxr/lib/LXR/Common.pm @@ -1,4 +1,4 @@ -# $Id: Common.pm,v 1.28 2005/12/21 05:28:13 timeless%mozdev.org Exp $ +# $Id: Common.pm,v 1.29 2005/12/27 16:23:20 timeless%mozdev.org Exp $ package LXR::Common; @@ -569,10 +569,61 @@ sub bannerexpand { } } -sub pathname { - return $Path->{'virtf'}; +sub cvsentriesexpand { + my ($entryrev, $entrybranch); + local $,=" | "; + my ($entriespath, $entryname) = split m|/(?!.*/)|, $Path->{'realf'}; + if (open(CVSENTRIES, "$entriespath/CVS/Entries")) { + while () { + next unless m|^/\Q$entryname\E/([^/]*)/[^/]*/[^/]*/(.*)|; + ($entryrev,$entrybranch)=($1,$2); + $entrybranch =~ s/^T//; + $entrybranch ||= 'HEAD'; + } + close(CVSENTRIES); + } + return ($entryrev, $entrybranch); } +sub cvstagexpand { + my $entrybranch; + if (open(CVSTAG, " $Path->{'real'}/CVS/Tag")) { + while () { + next unless m|^T(.*)$|; + $entrybranch = $1; + } + close(CVSTAG); + } + return $entrybranch || 'HEAD'; +} + +sub cvsversionexpand { + if ($who eq 'source') { + my ($entryrev,undef) = cvsentriesexpand(); + return $entryrev; + } + if ($who eq 'sourcedir') { + return cvstagexpand(); + } + return(''); +} + +sub cvsbranchexpand { + if ($who eq 'source') { + my (undef,$entrybranch) = cvsentriesexpand(); + return $entrybranch; + } + if ($who eq 'sourcedir') { + return cvstagexpand(); + } + return(''); +} + +sub pathname { + my $prefix = ''; + $prefix = '/' . $Conf->prefix if defined $Conf->prefix; + return (url_quote ($prefix . $Path->{'virtf'})); +} sub treename { return $Conf->{'treename'}; @@ -804,6 +855,8 @@ sub makeheader { ('treename', \&treename), ('modes', \&modeexpand), ('bonsaicvsroot', \&bonsaicvsroot), + ('cvsversion', \&cvsversionexpand), + ('cvsbranch', \&cvsbranchexpand), ('variables', \&varexpand))); } diff --git a/webtools/lxr/template-source-head b/webtools/lxr/template-source-head index 2363a8233122..6fbaa92c143a 100644 --- a/webtools/lxr/template-source-head +++ b/webtools/lxr/template-source-head @@ -26,8 +26,8 @@ @@ -44,9 +44,9 @@ changes to
this file in
the last:
- CVS Log
- CVS Blame
+ CVS Log
+ CVS Blame

- day
- week
- month
+ day
+ week
+ month
diff --git a/webtools/lxr/template-sourcedir-head b/webtools/lxr/template-sourcedir-head index f4dbab2c8fc6..73d7b583020d 100644 --- a/webtools/lxr/template-sourcedir-head +++ b/webtools/lxr/template-sourcedir-head @@ -32,9 +32,9 @@ changes to
this directory
in the last: - day
- week
- month
+ day
+ week
+ month