/[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 537 by dpavlin, Wed Nov 26 16:34:25 2008 UTC revision 576 by dpavlin, Fri Nov 28 00:09:51 2008 UTC
# Line 18  sub modified { Line 18  sub modified {
18          my ($self) = @_;          my ($self) = @_;
19          my @modified;          my @modified;
20          my $svk = $self->svk('status -q', sub {          my $svk = $self->svk('status -q', sub {
21                  push @modified, $1 if /^M\s+(.+)/;                  push @modified, $1 if /^(M|A)\s+(.+)/;
22          });          });
23          return @modified;          return @modified;
24  }  }
# 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          my $html          $diff = $self->html_escape( $diff );
62                  = qq|<pre>$status</pre><hr><pre>|          $self->add_css( qq|
63                  . $self->html_escape( $diff )          pre span.add { background: #dfd }
64  #               . $diff          pre span.del { background: #fdd }
65                  . qq|</pre>|          | );
66                  ;          $diff =~ s{^(\+.+?)$}{<span class="add">$1</span>}gm;
67          warn "diff ",length($html)," bytes";          $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 = $status . $diff;
73            warn "html ",length($html)," bytes";
74    
75          return $html;          return $html;
76  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26