/[Frey]/trunk/lib/SourceSnoop.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/SourceSnoop.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 187 by dpavlin, Sat Sep 13 14:19:04 2008 UTC revision 188 by dpavlin, Sat Sep 13 16:59:07 2008 UTC
# Line 15  our $debug = 1; Line 15  our $debug = 1;
15  sub pre_dump {  sub pre_dump {
16          my $o = shift;          my $o = shift;
17          # because Data::Dumper::HTML sucks          # because Data::Dumper::HTML sucks
18          my $t = $o->dump; $t =~ s/ {8}/  /gm;          my $t;
19            if ( blessed($o) && $o->can('dump') ) {
20                    $t = $o->dump;
21                    $t =~ s/ {8}/  /gm;
22            } else {
23                    $t = dump( $o );
24            }
25          return "<pre>$t</pre>";          return "<pre>$t</pre>";
26  }  }
27    
# Line 41  sub html { Line 47  sub html {
47          $request->print( $self->page( title => $path, body => $html ) );          $request->print( $self->page( title => $path, body => $html ) );
48          $request->next;          $request->next;
49    
50          my %param = $request->params;          %param = $request->params;
51          warn "## params = ",dump( %param );          warn "## params = ",dump( %param );
52    
53          my $project = $repo->get_project( name => $param{name} );          my $project = $repo->get_project( name => $param{name} );
54            my $rev = $project->head_revision;
55    
56            my $commit = $project->get_commit( revision => $rev );
57    
58            sub div {
59                    my ( $class, $text ) = @_;
60                    return "<div class=\"$class\">$text</div>";
61            }
62    
63            my $body =
64                    '<h1>Commit</h1>' .
65                    div( 'revision', $commit->revision ) .
66                    div( 'commiter', $commit->committer ) .
67                    div( 'date',     $commit->time->iso8601 ) .
68                    div( 'message',  $commit->message ) .
69                    '<pre>' . $commit->as_diff->raw . '</pre>';
70    
71          $request->print( $self->page(          $request->print( $self->page(
72                  title => $path . '/' . $project->name ,                  title => $path . '/' . $project->name,
73                  body => pre_dump( $project )                  body => $body,
74          ) );          ) );
75          $request->next;          $request->next;
76  }  }

Legend:
Removed from v.187  
changed lines
  Added in v.188

  ViewVC Help
Powered by ViewVC 1.1.26