summaryrefslogtreecommitdiff
path: root/d/sys/lampion
diff options
context:
space:
mode:
authordemonchy2005-08-09 21:52:19 +0000
committerdemonchy2005-08-09 21:52:19 +0000
commit62f5fd30a2b3e800a70a85dba6a2cbdc15668c2a (patch)
treed38acf771a4e8709564189320177a48cae7ab313 /d/sys/lampion
parent2c08e9e035d28c1b33b7851d2eab7fcb02a2858c (diff)
Ajout de svnlog (conversion des logs svn en html)
Diffstat (limited to 'd/sys/lampion')
-rw-r--r--d/sys/lampion/local/lib/svnlog/html.tt59
-rwxr-xr-xd/sys/lampion/local/sbin/svnlog74
-rw-r--r--d/sys/lampion/www/robot/svnlog.css43
3 files changed, 176 insertions, 0 deletions
diff --git a/d/sys/lampion/local/lib/svnlog/html.tt b/d/sys/lampion/local/lib/svnlog/html.tt
new file mode 100644
index 0000000..f6c05b8
--- /dev/null
+++ b/d/sys/lampion/local/lib/svnlog/html.tt
@@ -0,0 +1,59 @@
+[% USE date %]
+[% BLOCK msg %]
+ [% FOREACH msg = msgs %]
+ [% msg %] <br/>
+ [% END %]
+[% END %]
+[% BLOCK files_list %]
+ <ul>
+ [% FOREACH f = files %]
+ <li>[% f %]</li>
+ [% END %]
+ </ul>
+[% END %]
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+ <title>Log Svn </title>
+ <link rel="stylesheet" type="text/css" href="svnlog.css" media="screen" title="Normal" />
+ <link rel="alternate stylesheet" type="text/css" href="" media="screen" title="Sans habillage" />
+ </head>
+ <body><div id="page">
+ [% FOREACH r = revisions -%]
+ [% IF r.msg.size () > 0 %]
+ <div class="ci">
+ <div class="date">[% date.format (r.date, 'le %D à %H:%S') %]</div>
+ <div class="rev">Révision : [% r.rev %]</div>
+ <div class="author">
+ <h3> Auteur : </h3>
+ <p>[% r.author %]</p>
+ </div>
+ <div class="log">
+ <h3>Message : </h3>
+ <p>[% PROCESS msg msgs = r.msg %]</p>
+ </div>
+ [% IF r.exists ('upd') %]
+ <div class="log">
+ <h3>Fichiers modifiés :</h3>
+ [% PROCESS files_list files = r.upd %]
+ </div>
+ [% END %]
+ [% IF r.exists ('add') %]
+ <div class="log">
+ <h3>Fichiers ajoutés :</h3>
+ [% PROCESS files_list files = r.add %]
+ </div>
+ [% END %]
+ [% IF r.exists ('del') %]
+ <div class="log">
+ <h3>Fichiers supprimés :</h3>
+ [% PROCESS files_list files = r.del %]
+ </div>
+ [% END %]
+ </div>
+ [% END %]
+ [% END -%]
+ </div></body>
+</html>
diff --git a/d/sys/lampion/local/sbin/svnlog b/d/sys/lampion/local/sbin/svnlog
new file mode 100755
index 0000000..51af104
--- /dev/null
+++ b/d/sys/lampion/local/sbin/svnlog
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Template;
+use Getopt::Long qw(:config no_ignore_case);
+
+my $repos;
+my $template;
+my $n_old_revision = 10;
+my $svnlook = 'svnlook';
+
+sub parse_revision
+{
+ my ($r, $rev) = @_;
+ # General Information
+ my @cmd = `$svnlook --revision $r info $repos`;
+ map { chomp; } @cmd;
+ $$rev{rev} = $r;
+ $$rev{author} = shift @cmd;
+ $$rev{date} = shift @cmd;
+ shift @cmd; # log message size
+ pop @cmd while (@cmd && $cmd[-1] eq ''); # remove empty lines
+ $$rev{msg} = \@cmd;
+ # Changed
+ open OUT, "$svnlook --revision $r changed $repos|";
+ while (<OUT>)
+ {
+ if (/^([A-Z])\s+(.+)$/)
+ {
+ push @{$$rev{add}}, $2 and next if $1 eq 'A';
+ push @{$$rev{upd}}, $2 and next if $1 eq 'U';
+ push @{$$rev{del}}, $2 and next if $1 eq 'D';
+ }
+ }
+}
+
+sub usage
+{
+ print "Usage: $0 [ -n number of revisions to show ] -t template dir -r reposotory\n";
+ exit 0;
+}
+
+sub config
+{
+ my $help;
+ GetOptions ("h" => \$help,
+ "t=s" => \$template,
+ "n=i" => \$n_old_revision,
+ "r=s" => \$repos
+ );
+ die usage () if ((!defined $template and !defined $repos) or defined $help);
+}
+
+{
+ # Collect data
+ config ();
+ my $cur_rev =`$svnlook youngest $repos`;
+ chomp $cur_rev;
+ my $last_rev = $cur_rev - $n_old_revision;
+ $last_rev = 0 if ($last_rev < 0);
+ my @revisions;
+ for (my $i = $cur_rev; $i > $last_rev; $i --)
+ {
+ my %revision;
+ parse_revision ($i, \%revision);
+ push @revisions, \%revision;
+ }
+ # Print it
+ my $tt = new Template ({ INCLUDE_PATH => $template });
+ $tt->process ('html.tt', { revisions => \@revisions })
+ or die $tt->error;
+}
diff --git a/d/sys/lampion/www/robot/svnlog.css b/d/sys/lampion/www/robot/svnlog.css
new file mode 100644
index 0000000..0523318
--- /dev/null
+++ b/d/sys/lampion/www/robot/svnlog.css
@@ -0,0 +1,43 @@
+body {
+ background : #cccccc;
+ padding : 1em;
+ margin : 0;
+}
+
+#page {
+ border : 1px dashed #000000;
+ background : #ffffff;
+ padding : 1em;
+}
+
+.ci {
+ border : 1px solid #003366;
+ background : #99ccee;
+ padding : 0em 0;
+ margin : 1em 0;
+}
+.ci .date {
+ float : right;
+ color : darkred;
+ margin : 0 1em 0 0;
+ font-weight : bold;
+
+}
+.ci .rev {
+ padding : 0 0 0 1em;
+ background : #6699cc;
+ font-weight : bold;
+}
+.ci .author, .ci .log {
+ padding : 0 1em;
+}
+.ci h3 {
+ font-size : 11pt;
+ text-decoration : underline;
+ padding: 0;
+ margin: 0.2em;
+}
+.ci .author p, .ci .log p, .ci .log li{
+ /*font-family : 'monospace';*/
+ margin : 0 0 0 1em;
+}