19 |
isa => 'Str', |
isa => 'Str', |
20 |
); |
); |
21 |
|
|
22 |
has message => ( |
has commit_message => ( |
23 |
documentation => 'commit message', |
documentation => 'commit message', |
24 |
is => 'rw', |
is => 'rw', |
25 |
isa => 'Str', |
isa => 'Str', |
67 |
my ($self) = @_; |
my ($self) = @_; |
68 |
my $status = `svk status -q`; |
my $status = `svk status -q`; |
69 |
# $status =~ s{^(\w+\s+)(\S+)$}{$1<input name="commit_path" value="$2" type="checkbox"><a href="#$2">$2</a>}gm; # FIXME |
# $status =~ s{^(\w+\s+)(\S+)$}{$1<input name="commit_path" value="$2" type="checkbox"><a href="#$2">$2</a>}gm; # FIXME |
70 |
$status =~ s{^(\w+\s+)(\S+)$}{$1<a href="#$2">$2</a>}gm; |
$status =~ s{^(\w+[\+\s]+)(\S+)$}{$1<a href="#$2">$2</a>}gm; |
71 |
if ( $status ) { |
if ( $status ) { |
72 |
$self->add_css(qq| |
$self->add_css(qq| |
73 |
pre.l a { text-decoration: none; } |
pre.l a { text-decoration: none; } |
82 |
| ); |
| ); |
83 |
|
|
84 |
$status = qq| |
$status = qq| |
85 |
<div class="commit"> |
<div class="commit" method="post"> |
86 |
<form> |
<form> |
87 |
<textarea name="message" cols=40 rows=4></textarea> |
<textarea name="commit_message" cols=40 rows=4></textarea> |
88 |
<br><input type="submit" name="action" value="commit"> |
<br><input type="submit" name="action" value="commit"> |
89 |
</form> |
</form> |
90 |
</div> |
</div> |
110 |
| ); |
| ); |
111 |
$diff =~ s{^(\+.+?)$}{<span class="add">$1</span>}gm; |
$diff =~ s{^(\+.+?)$}{<span class="add">$1</span>}gm; |
112 |
$diff =~ s{^(\-.+?)$}{<span class="del">$1</span>}gm; |
$diff =~ s{^(\-.+?)$}{<span class="del">$1</span>}gm; |
113 |
$diff =~ s{^(===\s+)(\S+)$}{$1<form class="revert"><input type="hidden" name="path" value="$2"><input type="submit" name="action" value="revert"></form> <a name="$2">$2</a>}gm; |
$diff =~ s{^(===\s+)(\S+)$}{$1<form class="revert"><input type="hidden" name="path" value="$2"><input type="submit" name="action" value="revert"></form> <a name="$2" target="editor" href="/editor+$2+1">$2</a>}gm; |
114 |
|
|
115 |
$diff = qq|<pre>$diff</pre>|; |
$diff = qq|<pre>$diff</pre>|; |
116 |
warn "diff_as_markup ",length($diff)," bytes"; |
warn "diff_as_markup ",length($diff)," bytes"; |
125 |
if ( $self->action ) { |
if ( $self->action ) { |
126 |
my $cmd = 'svk ' . $self->action . ' ' . $self->path; |
my $cmd = 'svk ' . $self->action . ' ' . $self->path; |
127 |
if ( $self->action eq 'commit' ) { |
if ( $self->action eq 'commit' ) { |
128 |
confess "need message" unless $self->message; |
confess "need commit message" unless $self->commit_message; |
129 |
my $msg = $self->message; |
my $msg = $self->commit_message; |
130 |
$msg =~ s{"}{\\"}gs; |
$msg =~ s{"}{\\"}gs; |
131 |
$cmd .= qq{ -m "$msg"}; |
$cmd .= qq{ -m "$msg"}; |
132 |
} else { |
} else { |
150 |
$self->TODO( "Frey::Web role missing" ); |
$self->TODO( "Frey::Web role missing" ); |
151 |
} |
} |
152 |
|
|
153 |
$html .= $self->status_as_markup || $self->error('no status_or_markup output'); |
$html .= $self->status_as_markup || 'No changes in files tracked by SVK'; |
154 |
$html .= $self->diff_as_markup || $self->error('no diff_as_markup output'); |
$html .= $self->diff_as_markup; |
155 |
|
|
156 |
warn "as_markup ",length($html)," bytes"; |
warn "as_markup ",length($html)," bytes"; |
157 |
|
|