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 |
} |
} |
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; } |
111 |
|
|
112 |
$diff = $self->html_escape( $diff ); |
$diff = $self->html_escape( $diff ); |
113 |
$self->add_css( qq| |
$self->add_css( qq| |
114 |
|
pre span.add, |
115 |
|
pre span.del { |
116 |
|
float: left; |
117 |
|
width: 100%; |
118 |
|
} |
119 |
pre span.add { background: #dfd } |
pre span.add { background: #dfd } |
120 |
pre span.del { background: #fdd } |
pre span.del { background: #fdd } |
121 |
pre form.inline { display: inline } |
pre form.inline { display: inline } |
122 |
| ); |
| ); |
123 |
$diff =~ s{^(\+.+?)$}{<span class="add">$1</span>}gm; |
$diff =~ s{^(\+.*?)$}{<span class="add">$1</span>}gm; |
124 |
$diff =~ s{^(\-.+?)$}{<span class="del">$1</span>}gm; |
$diff =~ s{^(\-.*?)$}{<span class="del">$1</span>}gm; |
125 |
sub form { |
sub form { |
126 |
my ( $path, $action ) = @_; |
my ( $path, $action ) = @_; |
127 |
qq|<form class="inline" method="post"><input type="hidden" name="path" value="$path"><input type="submit" name="action" value="$action"></form>|; |
qq|<form class="inline" method="post"><input type="hidden" name="path" value="$path"><input type="submit" name="action" value="$action"></form>|; |