--- trunk/lib/Frey/SVK.pm 2008/12/06 14:35:15 737 +++ trunk/lib/Frey/SVK.pm 2009/06/30 15:10:55 1133 @@ -2,8 +2,7 @@ use Moose; extends 'Frey'; -with 'Frey::Web'; -with 'Frey::Path'; +with 'Frey::Web', 'Frey::Path', 'Frey::HTML::Diff'; use Moose::Util::TypeConstraints; @@ -36,11 +35,13 @@ close($svk) or die "can't close svk $exec: $@"; } +our $svk_status_path = '^(\w+[\+\s]+)(.+)'; + sub modified { my ($self) = @_; my @modified; my $svk = $self->svk('status -q', sub { - push @modified, $1 if /^\w+\s+(.+)/; + push @modified, $2 if m{$svk_status_path}; }); return @modified; } @@ -67,7 +68,7 @@ sub commit_as_markup { my ($self) = @_; my $status = `svk status -q`; - $status =~ s{^(\w+[\+\s]+)(\S+)$}{$1 . $self->checkbox('path',$2) . qq|$2|}egm; + $status =~ s{$svk_status_path}{$1 . $self->checkbox('path',$2) . qq|$2|}egm; if ( $status ) { $self->add_css(qq| pre.l a { text-decoration: none; } @@ -92,7 +93,9 @@
$status
-
+
+ test +
|; $self->add_status( status => $status ); @@ -107,21 +110,14 @@ my $diff = `svk diff`; $self->add_status( diff => $diff ); - $diff = $self->html_escape( $diff ); - $self->add_css( qq| - pre span.add { background: #dfd } - pre span.del { background: #fdd } - pre form.inline { display: inline } - | ); - $diff =~ s{^(\+.+?)$}{$1}gm; - $diff =~ s{^(\-.+?)$}{$1}gm; + $diff = $self->html_diff( $diff ); + sub form { my ( $path, $action ) = @_; qq|
|; }; $diff =~ s{^(===\s+)(\S+)$}{$1 . form($2,'revert') . qq| $2 | . form($2,'postpone') }gem; - $diff = qq|
$diff
| if $diff; warn "diff_as_markup ",length($diff)," bytes"; return $diff; } @@ -164,6 +160,7 @@ return qq| Command $cmd produced output:
$out
+ reload page to prevent this post from triggering again
|; } @@ -184,4 +181,8 @@ return $html; } +__PACKAGE__->meta->make_immutable; +no Moose; +no Moose::Util::TypeConstraints; + 1;