/[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 1066 by dpavlin, Mon Apr 27 18:45:14 2009 UTC revision 1067 by dpavlin, Mon Apr 27 19:55:32 2009 UTC
# Line 39  has include_diff => ( Line 39  has include_diff => (
39          default => 1,          default => 1,
40  );  );
41    
42    has file_stats => (
43            is => 'ro',
44            isa => 'Bool',
45            default => 1,
46    );
47    
48  sub iterator {  sub iterator {
49          my ($self,$coderef) = @_;          my ($self,$coderef) = @_;
50                    
# Line 108  sub iterator { Line 114  sub iterator {
114          foreach my $e (@{$xml->{'logentry'}}) {          foreach my $e (@{$xml->{'logentry'}}) {
115                  warn "# e = ",$self->dump( $e ) if $self->debug;                  warn "# e = ",$self->dump( $e ) if $self->debug;
116    
117                  if ( $self->include_diff ) {                  if ( $self->include_diff || $self->file_stats ) {
118                          my $rev = $e->{'revision'};                          my $rev = $e->{'revision'};
119                          my $file = $svn_path;                          my $file = $svn_path;
120                          $file =~ s{^\w+:/+}{};                          $file =~ s{^\w+:/+}{};
121                          my $file = "var/svn/$path.diff";                          my $file = "var/svn/$file/$rev.diff";
122                          my $diff = $self->load( $file );                          my $diff = $self->load( $file );
123                          if ( ! $diff ) {                          if ( ! $diff ) {
124                                  $diff = `svn diff -c $rev $svn_path`;                                  $diff = `svn diff -c $rev $svn_path`;
125                                  $self->store( $file, $diff );                                  $self->store( $file, $diff );
126                          }                          }
127                          $e->{diff} .= $diff;  
128                            $e->{diff} .= $diff if $self->include_diff;
129    
130                            $e->{diff_paths}->{rev} = $rev; # XXX debug
131    
132                            my $diff_path;
133                            foreach my $line ( split(/[\n\r]/, $diff ) ) {
134                                    if ( $line =~ m{^\+\+\+ (\S+)} ) {
135                                            $diff_path = "/$1"; # subversion paths start with /
136                                    } elsif ( $line =~ m{^\+} ) {
137                                            $e->{diff_paths}->{$diff_path}->{added}++;
138                                    } elsif ( $line =~ m{^-} ) {
139                                            $e->{diff_paths}->{$diff_path}->{removed}++;
140                                    }
141                            }
142                  }                  }
143    
144                  $coderef->($e);                  $coderef->($e);
# Line 219  sub as_markup { Line 239  sub as_markup {
239    
240                  my $diff = $self->html_diff( $e->{diff} ) if $e->{diff};                  my $diff = $self->html_diff( $e->{diff} ) if $e->{diff};
241    
242                    $html .= $self->dump( $e->{diff_paths} );
243    
244                  $html .= qq|                  $html .= qq|
245                          <div class="commit">                          <div class="commit">
246                                  <span class="date">$date</span>                                  <span class="date">$date</span>
# Line 269  sub codeswarm_as_markup { Line 291  sub codeswarm_as_markup {
291    
292                  foreach my $p (@{$e->{'paths'}->{'path'}}) {                  foreach my $p (@{$e->{'paths'}->{'path'}}) {
293                          my ($action,$path) = ($p->{'action'},$p->{'content'});                          my ($action,$path) = ($p->{'action'},$p->{'content'});
294                          $file_events .= qq|\t<event filename="$path" date="$date" author="$author" />\n|;                          my $weight = '';
295                            if ( defined   $e->{diff_paths}->{$path} ) {
296                                    $weight  = $e->{diff_paths}->{$path}->{removed};
297                                    $weight += $e->{diff_paths}->{$path}->{added} * 2;
298                                    $weight  = qq| weight="$weight" |;
299                            }
300                            $file_events .= qq|\t<event filename="$path" date="$date" author="$author"$weight/>\n|;
301                  }                  }
302    
303          });          });

Legend:
Removed from v.1066  
changed lines
  Added in v.1067

  ViewVC Help
Powered by ViewVC 1.1.26