/[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 505 by dpavlin, Mon Nov 24 22:21:02 2008 UTC
# Line 3  use Moose; Line 3  use Moose;
3    
4  with 'Frey::Escape';  with 'Frey::Escape';
5    
6    sub svk {
7            my ( $self, $exec, $coderef ) = @_;
8            open(my $svk, '-|', 'svk ' . $exec) or die "svk $exec: $@";
9            while(<$svk>) {
10                    chomp;
11                    $coderef->( $_ );
12            }
13            close($svk) or die "can't close svk $exec: $@";
14    }
15    
16  sub modified {  sub modified {
17          my ($self) = @_;          my ($self) = @_;
18          my @modified;          my @modified;
19          open(my $svk, '-|', 'svk status -q') or die $@;          my $svk = $self->svk('status -q', sub {
         while(<$svk>) {  
                 chomp;  
20                  push @modified, $1 if /^M\s+(.+)/;                  push @modified, $1 if /^M\s+(.+)/;
21          }          });
22          return @modified;          return @modified;
23  }  }
24    
25    our $info; # cache, we use it on every hit
26    sub info {
27            my ($self) = @_;
28            return $info if $info;
29            my $svk = $self->svk('info', sub {
30                    my ( $label, $value ) = split(/:\s+/, $_, 2);
31                    $info->{$label} = $value;
32            });
33            return $info;
34    }
35    
36  sub as_data {  sub as_data {
37          my ($self) = @_;          my ($self) = @_;
38          {          {

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

  ViewVC Help
Powered by ViewVC 1.1.26