CVS-Metrics

 view release on metacpan or  search on metacpan

bin/cvs_current  view on Meta::CPAN

      <th width='20%'>Added files</th>
      <th width='20%'>Modified files</th>
      <th width='20%'>Deleted files</th>
    </tr>
  <!-- TMPL_LOOP NAME=summary -->
    <tr>
      <td><a href='#<TMPL_VAR NAME=dir>'><!-- TMPL_VAR NAME=dir --></a></td>
      <td><!-- TMPL_VAR NAME=added --></td>
      <td><!-- TMPL_VAR NAME=modified --></td>
      <td><!-- TMPL_VAR NAME=deleted --></td>
    </tr>
  <!-- /TMPL_LOOP -->
    <tr class='total'>
      <td>TOTAL</td>
      <td><!-- TMPL_VAR NAME=total_added --></td>
      <td><!-- TMPL_VAR NAME=total_modified --></td>
      <td><!-- TMPL_VAR NAME=total_deleted --></td>
    </tr>
  </table>
  <hr />
  <h2>Detailed Evolution Report</h2>
  <table border='1' cellpadding='5'>
    <tr>
      <th width='20%'>Directories</th>
      <th width='40%'>Messages</th>
      <th width='30%'>File Descriptions</th>
      <th width='10%'>Actions</th>
    </tr>
  <!-- TMPL_LOOP NAME=dirs --><tr>
      <td valign='top' rowspan='<TMPL_VAR NAME=rowspan>'><a id='<TMPL_VAR NAME=dir>'
                 name='<TMPL_VAR NAME=dir>' /><!-- TMPL_VAR NAME=dir --></td>
    <!-- TMPL_LOOP NAME=comments -->
      <!-- TMPL_UNLESS NAME=__FIRST__ --><tr><!-- /TMPL_UNLESS -->
      <td valign='top' rowspan='<TMPL_VAR NAME=rowspan>'><!-- TMPL_VAR NAME=comment --></td>
      <!-- TMPL_LOOP NAME=files -->
        <!-- TMPL_UNLESS NAME=__FIRST__ --><tr><!-- /TMPL_UNLESS -->
        <td><span class='filename'><!-- TMPL_VAR NAME=filename --></span>
            <span class='revision'><!-- TMPL_VAR NAME=revision --></span><br />
          <!-- TMPL_LOOP NAME=tags -->
            <span class='tag'><!-- TMPL_VAR NAME=tag --></span><br />
          <!-- /TMPL_LOOP -->
            <span class='author'><!-- TMPL_VAR NAME=author --></span>
            <span class='date'><!-- TMPL_VAR NAME=date --></span></td>
        <td><!-- TMPL_VAR NAME=action --></td>
      </tr><!-- /TMPL_LOOP -->
    <!-- /TMPL_LOOP -->
  <!-- /TMPL_LOOP -->
  </table>
  <hr />
  <cite>Generated by cvs_current (<!-- TMPL_VAR NAME=date -->)</cite>
  </body>
</html>
};

my $style = q{
      body  { background-color: #FFFFCC }
      table { background-color: #FFFFFF }
      th    { background-color: #DCDCDC }
      h1    { text-align: center }
      h2    { color: red }
      td a  { font-weight: bold }
      tr.total      { font-weight: bold }
      table.layout  { background-color: #FFFFCC }
      span.author   { font-weight: bold }
      span.filename { color: blue }
      span.revision { font-weight: bold; color: blue }
      span.tag      { font-weight: bold }
      span.date     { }
      span.deleted  { font-weight: bold; color: red }
      span.added    { font-weight: bold; color: blue }
      span.modified { font-weight: bold }
};

    my $template = HTML::Template->new(
            loop_context_vars   => 1,
            scalarref           => \$html,
    );
    die "can't create template ($!).\n"
            unless (defined $template);

    my $now = localtime();
    my $generator = 'cvs_current ' . $CVS::Metrics::VERSION . ' (Perl ' . $] . ')';
    my $dir = $path eq '.' ? 'all' : $path;
    my $title_full = "${title} ${dir} ${tag_from} to ${tag_to}";

    my $image = $cvs_log->EnergyGD($tags, $path, $dir, 600, 400, $tag_from, $tag_to);

    my $e_img = "e_${title_full}.png";
    $e_img =~ s/[ \/]/_/g;
    my $filename = (defined $output) ? $output . '/' . $e_img : $e_img;
    if (defined $image) {
        open my $OUT, '>', $filename
                or die "can't open $filename ($!).\n";
        binmode $OUT, ':raw';
        print $OUT $image->png();
        close $OUT;
    }

    my $timed_tag = $cvs_log->getTimedTag($regex_ignore_tag);
    my @timed_tag = ();
    foreach my $tag (@{$tags}) {
        if ($tag eq 'HEAD') {
            push @timed_tag, {
                    tag     => $tag,
                    timed   => 'now',
            };
        }
        else {
            push @timed_tag, {
                    tag     => $tag,
                    timed   => substr($timed_tag->{$tag}, 0, 10),
            };
        }
    }

    my $date_from = substr $timed_tag->{$tag_from}, 0, 10;
    my $date_to = substr $timed_tag->{$tag_to}, 0, 10;
    $image = $cvs_log->ActivityGD($path, $dir, $start_date, 800, 225, $date_from, $date_to);

    my $a_img = "a_${title_full}.png";
    $a_img =~ s/[ \/]/_/g;
    $filename = (defined $output) ? $output . '/' . $a_img : $a_img;
    if (defined $image) {
        open my $OUT, '>', $filename
                or die "can't open $filename ($!).\n";
        binmode $OUT, ':raw';
        print $OUT $image->png();
        close $OUT;
    }

    my $dir_evol = $cvs_log->getDirEvolution($path, $tag_from, $tag_to, $tags);

bin/cvs_current  view on Meta::CPAN

  <h1><!-- TMPL_VAR NAME=title --></h1>
  <hr />
  <h2>Branch Report Summary</h2>
  <table border='1' cellpadding='5'>
    <tr>
      <th>Directories</th>
      <th># files</th>
    </tr>
  <!-- TMPL_LOOP NAME=summary -->
    <tr>
      <td><a href='#<TMPL_VAR NAME=dir>'><!-- TMPL_VAR NAME=dir --></a></td>
      <td><!-- TMPL_VAR NAME=nb --></td>
    </tr>
  <!-- /TMPL_LOOP -->
    <tr class='total'>
      <td>TOTAL</td>
      <td><!-- TMPL_VAR NAME=total --></td>
    </tr>
  </table>
  <hr />
  <h2>Branch Evolution Report</h2>
  <table border='1' cellpadding='5'>
    <tr>
      <th width='20%'>Directories</th>
      <th width='40%'>Messages</th>
      <th width='30%'>File Descriptions</th>
      <th width='10%'>Actions</th>
    </tr>
  <!-- TMPL_LOOP NAME=dirs --><tr>
      <td valign='top' rowspan='<TMPL_VAR NAME=rowspan>'><a id='<TMPL_VAR NAME=dir>'
                 name='<TMPL_VAR NAME=dir>' /><!-- TMPL_VAR NAME=dir --></td>
    <!-- TMPL_LOOP NAME=comments -->
      <!-- TMPL_UNLESS NAME=__FIRST__ --><tr><!-- /TMPL_UNLESS -->
      <td valign='top' rowspan='<TMPL_VAR NAME=rowspan>'><!-- TMPL_VAR NAME=comment --></td>
      <!-- TMPL_LOOP NAME=files -->
        <!-- TMPL_UNLESS NAME=__FIRST__ --><tr><!-- /TMPL_UNLESS -->
        <td><span class='filename'><!-- TMPL_VAR NAME=filename --></span>
            <span class='revision'><!-- TMPL_VAR NAME=revision --></span><br />
          <!-- TMPL_LOOP NAME=tags -->
            <span class='tag'><!-- TMPL_VAR NAME=tag --></span><br />
          <!-- /TMPL_LOOP -->
            <span class='author'><!-- TMPL_VAR NAME=author --></span>
            <span class='date'><!-- TMPL_VAR NAME=date --></span></td>
        <td><!-- TMPL_VAR NAME=action --></td>
      </tr><!-- /TMPL_LOOP -->
    <!-- /TMPL_LOOP -->
  <!-- /TMPL_LOOP -->
  </table>
  <hr />
  <cite>Generated by cvs_current (<!-- TMPL_VAR NAME=date -->)</cite>
  </body>
</html>
};

my $style = q{
      body  { background-color: #FFFFCC }
      table { background-color: #FFFFFF }
      th    { background-color: #DCDCDC }
      h1    { text-align: center }
      h2    { color: red }
      td a  { font-weight: bold }
      tr.total      { font-weight: bold }
      table.layout  { background-color: #FFFFCC }
      span.author   { font-weight: bold }
      span.filename { color: blue }
      span.revision { font-weight: bold; color: blue }
      span.tag      { font-weight: bold }
      span.date     { }
      span.deleted  { font-weight: bold; color: red }
      span.added    { font-weight: bold; color: blue }
      span.modified { font-weight: bold }
};

    my $template = HTML::Template->new(
            loop_context_vars   => 1,
            scalarref           => \$html,
    );
    die "can't create template ($!).\n"
            unless (defined $template);

    my $now = localtime();
    my $generator = 'cvs_current ' . $CVS::Metrics::VERSION . ' (Perl ' . $] . ')';
    my $title_full = "${title} ${branch}";


    my $dir_evol = $cvs_log->getDirBranch($path, $branch);
    my @summary = ();
    my $total = 0;
    foreach my $dirname (sort keys %{$dir_evol}) {
        my $nb = $dir_evol->{$dirname};
        next unless ($nb);
        push @summary, {
            dir     => $dirname,
            nb      => $nb,
        };
        $total += $nb;
    }

    my $evol = $cvs_log->getBranch($path, $branch);
    my @dirs = ();
    foreach my $dirname (sort keys %{$evol}) {
        my $dir = $evol->{$dirname};
        my %date_sorted;
        next unless (scalar keys %{$dir});
        foreach my $message (keys %{$dir}) {
            my $files = $dir->{$message};
            my $file0 = $files->[0];
            $date_sorted{$file0->{date}} = $message;
        }
        my $rowspan1 = 0;
        my @comments = ();
        foreach (sort keys %date_sorted) {
            my $message = $date_sorted{$_};
            my $files = $dir->{$message};
            my $rowspan2 = 0;
            my @files = ();
            foreach my $file (@{$files}) {
                my @tags = ();
                foreach my $tag (sort @{$file->{tags}}) {
                    push @tags, {
                        tag         => $tag,
                    };
                }
                my $action;
                if ($file->{state} eq 'dead') {
                    $action = "<span class='deleted'>DELETED</span>";
                }
                else {
                    if ($file->{revision} =~ /^1\.1(\.\d+\.1)?$/) {
                        $action = "<span class='added'>ADDED</span>";
                    }



( run in 0.755 second using v1.01-cache-2.11-cpan-364913b4093 )