/[Frey]/trunk/lib/Frey/SVN.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/Frey/SVN.pm

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

revision 805 by dpavlin, Wed Dec 10 23:03:04 2008 UTC revision 875 by dpavlin, Wed Dec 17 19:40:31 2008 UTC
# Line 11  with 'Frey::Web'; Line 11  with 'Frey::Web';
11  #with 'Frey::Storage';  #with 'Frey::Storage';
12    
13  use XML::Simple;  use XML::Simple;
14    use DateTimeX::Easy;
15    
16  has repository => (  has repository => (
17          is => 'rw',          is => 'rw',
# Line 90  sub iterator { Line 91  sub iterator {
91          my $xml = XMLin($log, ForceArray => [ 'logentry', 'path' ]);          my $xml = XMLin($log, ForceArray => [ 'logentry', 'path' ]);
92    
93          foreach my $e (@{$xml->{'logentry'}}) {          foreach my $e (@{$xml->{'logentry'}}) {
94                  warn "# e = ",$self->dump( $e );                  warn "# e = ",$self->dump( $e ) if $self->debug;
95                  $coderef->($e);                  $coderef->($e);
96          }          }
97  }  }
# Line 107  sub as_markup { Line 108  sub as_markup {
108                  $foo =~ s/</&lt;/g;                  $foo =~ s/</&lt;/g;
109                  $foo =~ s/>/&gt;/g;                  $foo =~ s/>/&gt;/g;
110                  $foo =~ s/"/&quot;/g;                  $foo =~ s/"/&quot;/g;
111                  $foo =~ s/([\n\r][\n\r]+)/<\/p>$1<p>/gis;                  $foo =~ s/([\n\r][\n\r]+)/$1<br\/>/gis;
112                  $foo =~ s/([\n\r]+)([\-\*]\s+)/$1<br\/>$2/gis;                  $foo =~ s/([\n\r]+)([\-\*]\s+)/$1<br\/>$2/gis;
113                  $foo =~ s/([\n\r]+)(r\d+:\s+)/$1<br\/>$2/gis;                  $foo =~ s/([\n\r]+)(r\d+:\s+)/$1<br\/>$2/gis;
114                  $foo =~ s/([\n\r]+)(\s+r\d+@)/$1<br\/>$2/gis;           # svk                  $foo =~ s/([\n\r]+)(\s+r\d+@)/$1<br\/>$2/gis;           # svk
# Line 115  sub as_markup { Line 116  sub as_markup {
116          }          }
117    
118          our $html = '';          our $html = '';
119          sub html {  
120                  $html .= join("\n", @_);          $self->add_css(qq|
121          }                  .files { color: #888; font-family: monospace; }
122                    .date, .revision { color: #666; }
123                    .message { padding-bottom: 0.5em; }
124    
125                    ins { color: #8c8 }
126                    del { color: #c88 }
127            |);
128    
129          $self->iterator( sub {          $self->iterator( sub {
130                  my $e = shift;                  my $e = shift;
# Line 128  sub as_markup { Line 135  sub as_markup {
135                  $date =~ s/T/ /;                  $date =~ s/T/ /;
136                  $date =~ s/\.\d+Z$//;                  $date =~ s/\.\d+Z$//;
137    
138                  html '<p><tt>'.$date.'</tt> <em>',$e->{'author'},'</em> <tt style="color:#808080">r',$e->{'revision'},'</tt></p>';                  $html .= qq|<div><span class="date">$date</span> <em>$e->{author}</em> <span class="revision">$e->{revision}</span></div>\n|;
139    
140                    my $msg = $e->{'msg'};
141                    $msg = '' if ref($msg); # FIXME why do I need this, dammit?
142                    if ( $msg ) {
143                            $msg = encode( $msg );
144                            $msg = qq|<div class="message">$msg</div>|;
145                    }
146    
147                  my @files;                  my @files;
148    
# Line 139  sub as_markup { Line 153  sub as_markup {
153                                  push @files, "<ins>$path</ins>";                                  push @files, "<ins>$path</ins>";
154                          } elsif ($action eq "D") {                          } elsif ($action eq "D") {
155                                  push @files, "<del>$path</del>";                                  push @files, "<del>$path</del>";
156                          } else{                          } else {
157                                  push @files, $path;                                  push @files, $path;
158                          }                          }
159                  }                  }
160    
161                  html '<blockquote><p><tt style="color:#808080">',join(", ",@files),':</tt> ',encode($e->{'msg'}),'</p></blockquote>';                  $html .= qq|<blockquote>\n$msg\n<div class="files">\n| . join(",\n",@files) . qq|\n</div>\n</blockquote>|;
162    
163          });          });
164    
# Line 162  sub codeswarm_as_markup { Line 176  sub codeswarm_as_markup {
176                  my $e = shift;                  my $e = shift;
177                                    
178                  my $rev = $e->{'revision'};                  my $rev = $e->{'revision'};
179                  my $date = $e->{'date'};                  my $date = DateTimeX::Easy->new( $e->{'date'} )->epoch . '000'; # ms
180                  my $author = $e->{'author'};                  my $author = $e->{'author'};
181    
182                  foreach my $p (@{$e->{'paths'}->{'path'}}) {                  foreach my $p (@{$e->{'paths'}->{'path'}}) {

Legend:
Removed from v.805  
changed lines
  Added in v.875

  ViewVC Help
Powered by ViewVC 1.1.26