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

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

revision 558 by dpavlin, Thu Nov 27 20:36:15 2008 UTC revision 576 by dpavlin, Fri Nov 28 00:09:51 2008 UTC
# Line 31  sub info { Line 31  sub info {
31                  my ( $label, $value ) = split(/:\s+/, $_, 2);                  my ( $label, $value ) = split(/:\s+/, $_, 2);
32                  $info->{$label} = $value if $label;                  $info->{$label} = $value if $label;
33          });          });
34            warn "# svk info ",$self->dump( $info );
35          return $info;          return $info;
36  }  }
37    
# Line 44  sub as_data { Line 45  sub as_data {
45  sub as_markup {  sub as_markup {
46          my ($self) = @_;          my ($self) = @_;
47    
48            if ( ! $self->can('html_escape') ) {
49                    Frey::Web->meta->apply( $self );
50                    $self->TODO( "Frey::Web role missing" );
51            }
52    
53          my $status = `svk status -q`;          my $status = `svk status -q`;
54            $status =~ s{^(\w+\s+)(\S+)$}{$1<a href="#$2">$2</a>}gm;
55            $self->add_css( qq| pre.l a { text-decoration: none; } | );
56            $status = qq|<pre class="l">$status</pre>|;
57            $self->add_status( $status );
58    
59          my $diff   = `svk diff`;          my $diff   = `svk diff`;
60    
61          Frey::Web->meta->apply( $self ) unless $self->can('html_escape');          $diff = $self->html_escape( $diff );
62            $self->add_css( qq|
63            pre span.add { background: #dfd }
64            pre span.del { background: #fdd }
65            | );
66            $diff =~ s{^(\+.+?)$}{<span class="add">$1</span>}gm;
67            $diff =~ s{^(\-.+?)$}{<span class="del">$1</span>}gm;
68            $diff =~ s{^(===\s+)(\S+)$}{$1<a name="$2">$2</a>}gm;
69    
70            $diff = qq|<pre>$diff</pre>|;
71    
72          my $html          my $html = $status . $diff;
73                  = qq|<pre>$status</pre><hr><pre>|          warn "html ",length($html)," bytes";
                 . $self->html_escape( $diff )  
                 . qq|</pre>|  
                 ;  
         warn "diff ",length($html)," bytes";  
74    
75          return $html;          return $html;
76  }  }

Legend:
Removed from v.558  
changed lines
  Added in v.576

  ViewVC Help
Powered by ViewVC 1.1.26