/[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 1068 by dpavlin, Mon Apr 27 20:30:20 2009 UTC revision 1070 by dpavlin, Mon Apr 27 21:06:40 2009 UTC
# Line 120  sub iterator { Line 120  sub iterator {
120    
121                          $e->{diff_paths}->{rev} = $rev; # XXX debug                          $e->{diff_paths}->{rev} = $rev; # XXX debug
122    
123                          my $diff_file = $svn_path;                          my $cache = $svn_path;
124                          $diff_file =~ s{^\w+:/+}{};                          $cache =~ s{^\w+:/+}{};
125                          mkpath "var/svn/$diff_file" unless -e "var/svn/$diff_file";                          $cache = "var/svn/$cache";
126                          $diff_file = "var/svn/$diff_file/$rev.diff";                          mkpath $cache unless -e $cache;
127                          my $diff_fh;                          my $diff_paths = $self->load( "$cache/$rev.yaml" );
128                          my $diff_out;                          if ( ! $diff_paths ) {
                         if ( ! -e $diff_file || ! -s $diff_file ) {  
129                                  my $cmd = "svn diff -c $rev $svn_path";                                  my $cmd = "svn diff -c $rev $svn_path";
130                                  open($diff_fh, '-|', $cmd )  || die "can't open pipe from $cmd: $!";                                  my ( $diff_fh, $diff_out );
131                                  open($diff_out,'>' , $diff_file ) || die "can't write $diff_file: $!";                                  my $diff_file = "$cache/$rev.diff";
132    
133                                    open($diff_fh, '-|', $cmd)       || die "can't open pipe from $cmd: $!";
134                                    open($diff_out,'>' , $diff_file) || die "can't write $diff_file: $!";
135                                  warn "# creating $diff_file from $cmd\n";                                  warn "# creating $diff_file from $cmd\n";
                         } else {  
                                 open($diff_fh, '<' , $diff_file ) || die "can't read $diff_file: $!";  
                         }  
136    
137                          my $diff_path;                                  my $diff_path;
138    
139                          while( <$diff_fh> ) {                                  while( <$diff_fh> ) {
140                                  $e->{diff} .= $_ if $self->include_diff;                                          print $diff_out $_;
141                                  print $diff_out $_ if defined $diff_out;  
142                                            if ( m{^\+\+\+ (\S+)} ) {
143                                  if ( m{^\+\+\+ (\S+)} ) {                                                  $diff_path = "/$1"; # subversion paths start with /
144                                          $diff_path = "/$1"; # subversion paths start with /                                          } elsif ( m{^\+} && $diff_path ) {
145                                  } elsif ( m{^\+} && $diff_path ) {                                                  $diff_paths->{$diff_path}->{added}++;
146                                          $e->{diff_paths}->{$diff_path}->{added}++;                                          } elsif ( m{^-} && $diff_path ) {
147                                  } elsif ( m{^-} && $diff_path ) {                                                  $diff_paths->{$diff_path}->{removed}++;
148                                          $e->{diff_paths}->{$diff_path}->{removed}++;                                          }
149                                  }                                  }
150    
151                                    $self->store( "$cache/$rev.yaml", $diff_paths );
152                          }                          }
153                            $e->{diff}       = $self->load( "$cache/$rev.diff" ) if $self->include_diff;
154                            $e->{diff_paths} = $self->load( "$cache/$rev.yaml" );
155                  }                  }
156    
157                  $coderef->($e);                  $coderef->($e);
# Line 303  sub codeswarm_as_markup { Line 306  sub codeswarm_as_markup {
306                          my ($action,$path) = ($p->{'action'},$p->{'content'});                          my ($action,$path) = ($p->{'action'},$p->{'content'});
307                          my $weight = '';                          my $weight = '';
308                          if ( my $s = $e->{diff_paths}->{$path} ) {                          if ( my $s = $e->{diff_paths}->{$path} ) {
309                                  $weight  = $s->{removed}   if $s->{removed};  
310                                  $weight += $s->{added} * 2 if $s->{added};                                  warn $self->dump( $s );
311                                    $weight  = $s->{removed}   if defined $s->{removed};
312                                    $weight += $s->{added} * 2 if defined $s->{added};
313                                  $weight  = qq| weight="$weight" |;                                  $weight  = qq| weight="$weight" |;
314                          }                          }
315                          $file_events .= qq|\t<event filename="$path" date="$date" author="$author"$weight/>\n|;                          $file_events .= qq|\t<event filename="$path" date="$date" author="$author"$weight/>\n|;

Legend:
Removed from v.1068  
changed lines
  Added in v.1070

  ViewVC Help
Powered by ViewVC 1.1.26