/[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 498 by dpavlin, Mon Nov 24 21:31:54 2008 UTC revision 558 by dpavlin, Thu Nov 27 20:36:15 2008 UTC
# Line 1  Line 1 
1  package Frey::SVK;  package Frey::SVK;
2  use Moose;  use Moose;
3    
4  with 'Frey::Escape';  extends 'Frey';
5    with 'Frey::Web';
6    
7  sub modified {  sub svk {
8          my ($self) = @_;          my ( $self, $exec, $coderef ) = @_;
9          my @modified;          open(my $svk, '-|', 'svk ' . $exec) or die "svk $exec: $@";
         open(my $svk, '-|', 'svk status -q') or die $@;  
10          while(<$svk>) {          while(<$svk>) {
11                  chomp;                  chomp;
12                  push @modified, $1 if /^M\s+(.+)/;                  $coderef->( $_ );
13          }          }
14            close($svk) or die "can't close svk $exec: $@";
15    }
16    
17    sub modified {
18            my ($self) = @_;
19            my @modified;
20            my $svk = $self->svk('status -q', sub {
21                    push @modified, $1 if /^(M|A)\s+(.+)/;
22            });
23          return @modified;          return @modified;
24  }  }
25    
26    our $info; # cache, we use it on every hit
27    sub info {
28            my ($self) = @_;
29            return $info if $info;
30            my $svk = $self->svk('info', sub {
31                    my ( $label, $value ) = split(/:\s+/, $_, 2);
32                    $info->{$label} = $value if $label;
33            });
34            return $info;
35    }
36    
37  sub as_data {  sub as_data {
38          my ($self) = @_;          my ($self) = @_;
39          {          {
# Line 27  sub as_markup { Line 47  sub as_markup {
47          my $status = `svk status -q`;          my $status = `svk status -q`;
48          my $diff   = `svk diff`;          my $diff   = `svk diff`;
49    
50            Frey::Web->meta->apply( $self ) unless $self->can('html_escape');
51    
52          my $html          my $html
53                  = qq|<pre>$status</pre><hr><pre>|                  = qq|<pre>$status</pre><hr><pre>|
54                  . $self->html_escape( $diff )                  . $self->html_escape( $diff )

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

  ViewVC Help
Powered by ViewVC 1.1.26