/[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 543 by dpavlin, Wed Nov 26 19:43:03 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 svk {
8            my ( $self, $exec, $coderef ) = @_;
9            open(my $svk, '-|', 'svk ' . $exec) or die "svk $exec: $@";
10            while(<$svk>) {
11                    chomp;
12                    $coderef->( $_ );
13            }
14            close($svk) or die "can't close svk $exec: $@";
15    }
16    
17  sub modified {  sub modified {
18          my ($self) = @_;          my ($self) = @_;
19          my @modified;          my @modified;
20          open(my $svk, '-|', 'svk status -q') or die $@;          my $svk = $self->svk('status -q', sub {
         while(<$svk>) {  
                 chomp;  
21                  push @modified, $1 if /^M\s+(.+)/;                  push @modified, $1 if /^M\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          {          {

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

  ViewVC Help
Powered by ViewVC 1.1.26