/[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 185 by dpavlin, Tue Sep 9 23:16:26 2008 UTC revision 188 by dpavlin, Sat Sep 13 16:59:07 2008 UTC
# Line 12  use Data::Dump qw/dump/; Line 12  use Data::Dump qw/dump/;
12    
13  our $debug = 1;  our $debug = 1;
14    
15  sub pre {  sub pre_dump {
16          my $t = shift;          my $o = shift;
17            # because Data::Dumper::HTML sucks
18            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 39  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( $project->dump )                  body => $body,
74          ) );          ) );
75          $request->next;          $request->next;
76  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26