--- trunk/lib/Frey/SVK.pm 2008/11/30 14:43:44 637
+++ trunk/lib/Frey/SVK.pm 2008/12/02 18:12:38 684
@@ -3,6 +3,7 @@
extends 'Frey';
with 'Frey::Web';
+with 'Frey::Path';
use Moose::Util::TypeConstraints;
@@ -63,15 +64,15 @@
}
}
-sub status_as_markup {
+sub commit_as_markup {
my ($self) = @_;
my $status = `svk status -q`;
-# $status =~ s{^(\w+\s+)(\S+)$}{$1$2}gm; # FIXME
- $status =~ s{^(\w+[\+\s]+)(\S+)$}{$1$2}gm;
+ $status =~ s{^(\w+[\+\s]+)(\S+)$}{$1$2}gm; # FIXME
+# $status =~ s{^(\w+[\+\s]+)(\S+)$}{$1$2}gm;
if ( $status ) {
$self->add_css(qq|
pre.l a { text-decoration: none; }
- div.commit {
+ form.commit {
background: #ffd;
padding: 1em 1em;
position: fixed;
@@ -81,19 +82,17 @@
}
| );
+
$status = qq|
-
-
-
+
|;
- $self->add_status( $status );
-
+ $self->add_status( status => $status );
+ warn "commit_as_markup ",length($status)," bytes";
}
- warn "status_as_markup ",length($status)," bytes";
return $status;
}
@@ -101,6 +100,7 @@
my ($self) = @_;
my $diff = `svk diff`;
+ $self->add_status( diff => $diff );
$diff = $self->html_escape( $diff );
$self->add_css( qq|
@@ -129,16 +129,19 @@
if ( $self->action eq 'postpone' ) {
my $old = $self->path;
- my $new = $old . '.postponed';
- die "Allready have $new" if -e $new;
+ my $new = $old;
+ $new =~ s{/([^/]+)$}{/.postponed.$1};
+
+ die "Allready have ", $self->path_size($new) if -e $new;
$cmd = "mv $old $new && svk revert $old";
} elsif ( $self->action ) {
- my $cmd = 'svk ' . $self->action . ' ' . $self->path;
+ $cmd = 'svk ' . $self->action;
if ( $self->action eq 'commit' ) {
- confess "need commit message" unless $self->commit_message;
- my $msg = $self->commit_message;
+ my $msg = $self->commit_message || confess "need commit message";
$msg =~ s{"}{\\"}gs;
$cmd .= qq{ -m "$msg"};
+ } elsif ( my $path = $self->path ) {
+ $cmd .= " $path";
} else {
confess "need path" unless $self->path;
}
@@ -158,13 +161,7 @@
$self->title( 'svk' . ( $self->action ? ' - ' . $self->action : '' ) ); # XXX without this we get wrong icon and title
- if ( ! $self->can('html_escape') ) {
- Frey::Web->meta->apply( $self );
- $self->TODO( "Frey::Web role missing" );
- }
-
- $html .= $self->status_as_markup || 'No changes in files tracked by SVK';
- $html .= $self->diff_as_markup;
+ $html .= $self->commit_as_markup . $self->diff_as_markup;
warn "as_markup ",length($html)," bytes";