36 |
close($svk) or die "can't close svk $exec: $@"; |
close($svk) or die "can't close svk $exec: $@"; |
37 |
} |
} |
38 |
|
|
39 |
|
our $svk_status_path = '^(\w+[\+\s]+)(.+)'; |
40 |
|
|
41 |
sub modified { |
sub modified { |
42 |
my ($self) = @_; |
my ($self) = @_; |
43 |
my @modified; |
my @modified; |
44 |
my $svk = $self->svk('status -q', sub { |
my $svk = $self->svk('status -q', sub { |
45 |
push @modified, $1 if /^\w+\s+(.+)/; |
push @modified, $2 if m{$svk_status_path}; |
46 |
}); |
}); |
47 |
return @modified; |
return @modified; |
48 |
} |
} |
66 |
} |
} |
67 |
} |
} |
68 |
|
|
|
sub checkbox { |
|
|
my ($self,$name,$value) = @_; |
|
|
my $checked = ''; |
|
|
my $all_checkboxes = $self->$name; |
|
|
$all_checkboxes = [ $all_checkboxes ] unless ref($all_checkboxes) eq 'ARRAY'; # sigh, too chatty |
|
|
$checked = ' checked' if grep { $_ eq $value } @$all_checkboxes; |
|
|
warn "# checkbox $name $value $checked\t", $self->dump( $self->$name ); |
|
|
qq|<input name="$name" value="$value" type="checkbox"$checked>|; |
|
|
} |
|
|
|
|
69 |
sub commit_as_markup { |
sub commit_as_markup { |
70 |
my ($self) = @_; |
my ($self) = @_; |
71 |
my $status = `svk status -q`; |
my $status = `svk status -q`; |
72 |
$status =~ s{^(\w+[\+\s]+)(\S+)$}{$1 . $self->checkbox('path',$2) . qq|<a href="#$2">$2</a>|}egm; |
$status =~ s{$svk_status_path}{$1 . $self->checkbox('path',$2) . qq|<a href="#$2">$2</a>|}egm; |
73 |
if ( $status ) { |
if ( $status ) { |
74 |
$self->add_css(qq| |
$self->add_css(qq| |
75 |
pre.l a { text-decoration: none; } |
pre.l a { text-decoration: none; } |
80 |
top: 1em; |
top: 1em; |
81 |
right: 1em; |
right: 1em; |
82 |
z-index: 10; |
z-index: 10; |
83 |
|
opacity: .2; |
84 |
|
filter: alpha(opacity=20); |
85 |
|
} |
86 |
|
form.commit:hover { |
87 |
|
opacity: 1; |
88 |
|
filter: alpha(opacity=100); |
89 |
} |
} |
90 |
| ); |
| ); |
91 |
|
|
149 |
} else { |
} else { |
150 |
confess "need path" unless $self->path; |
confess "need path" unless $self->path; |
151 |
} |
} |
152 |
$cmd .= ' ' . join(' ',$self->path); |
|
153 |
|
my @paths = eval { @{ $self->path } }; # XXX sigh! |
154 |
|
@paths = ( $self->path ) unless @paths; |
155 |
|
warn "# path ", $self->dump( @paths ); |
156 |
|
|
157 |
|
$cmd .= ' ' . join( ' ',@paths ); |
158 |
} |
} |
159 |
if ( $cmd ) { |
if ( $cmd ) { |
160 |
$cmd .= ' 2>&1'; |
$cmd .= ' 2>&1'; |
165 |
|
|
166 |
return qq| |
return qq| |
167 |
Command <tt>$cmd</tt> produced output: |
Command <tt>$cmd</tt> produced output: |
168 |
<pre style="background: #ff8;"> |
<pre style="background: #ff8;">$out</pre> |
|
$out |
|
|
</pre> |
|
169 |
|; |
|; |
170 |
} |
} |
171 |
|
|