/[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

Contents of /trunk/lib/Frey/SVK.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 535 - (show annotations)
Wed Nov 26 16:17:17 2008 UTC (15 years, 4 months ago) by dpavlin
File size: 1007 byte(s)
move Frey::Escape funcionality into Frey::Web and chop long warn lines
1 package Frey::SVK;
2 use Moose;
3
4 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 {
18 my ($self) = @_;
19 my @modified;
20 my $svk = $self->svk('status -q', sub {
21 push @modified, $1 if /^M\s+(.+)/;
22 });
23 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 {
38 my ($self) = @_;
39 {
40 modified => [ $self->modified ],
41 }
42 }
43
44 sub as_markup {
45 my ($self) = @_;
46
47 my $status = `svk status -q`;
48 my $diff = `svk diff`;
49
50 my $html
51 = qq|<pre>$status</pre><hr><pre>|
52 # . $self->html_escape( $diff )
53 . $diff
54 . qq|</pre>|
55 ;
56 warn "diff ",length($html)," bytes";
57
58 return $html;
59 }
60
61 1;

  ViewVC Help
Powered by ViewVC 1.1.26