|
Revision 367, 0.9 kB
(checked in by miya, 2 years ago)
|
Archer::Plugin::Shell: Added.
|
| Line | |
|---|
| 1 |
package Archer::Plugin::SVN::Diff; |
|---|
| 2 |
|
|---|
| 3 |
use strict; |
|---|
| 4 |
use warnings; |
|---|
| 5 |
use base qw( Archer::Plugin::SVN ); |
|---|
| 6 |
use SVN::Agent; |
|---|
| 7 |
use Term::Pager; |
|---|
| 8 |
|
|---|
| 9 |
sub run { |
|---|
| 10 |
my ($self, $context, $args) = @_; |
|---|
| 11 |
|
|---|
| 12 |
$ENV{LANG} = 'C'; |
|---|
| 13 |
|
|---|
| 14 |
my $path = $self->{config}->{path} |
|---|
| 15 |
|| File::Spec->catfile($context->{config}->{global}->{work_dir}, $context->{project}); |
|---|
| 16 |
$path = $self->templatize($path); |
|---|
| 17 |
|
|---|
| 18 |
my $rev = `svn info $path`; |
|---|
| 19 |
$rev = $1 if $rev =~ /Revision: (\d+)/; |
|---|
| 20 |
|
|---|
| 21 |
my $svn = SVN::Agent->load({ path => $path }); |
|---|
| 22 |
print eval { $svn->diff("-r$rev:HEAD") }; |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
1; |
|---|
| 26 |
__END__ |
|---|
| 27 |
|
|---|
| 28 |
=head1 NAME |
|---|
| 29 |
|
|---|
| 30 |
Archer::Plugin::SVN::Diff - svn diff |
|---|
| 31 |
|
|---|
| 32 |
=head1 SYNOPSIS |
|---|
| 33 |
|
|---|
| 34 |
- module: SVN::Diff |
|---|
| 35 |
config: |
|---|
| 36 |
path: "[% work_dir %]/[% project %]" |
|---|
| 37 |
|
|---|
| 38 |
=head1 DESCRIPTION |
|---|
| 39 |
|
|---|
| 40 |
Execute svn diff. |
|---|
| 41 |
|
|---|
| 42 |
=head1 CONFIG |
|---|
| 43 |
|
|---|
| 44 |
=head2 path |
|---|
| 45 |
|
|---|
| 46 |
Svn working directory path.Default is [% work_dir %]/[% project %]. |
|---|
| 47 |
|
|---|
| 48 |
=head1 AUTHORS |
|---|
| 49 |
|
|---|
| 50 |
Gosuke Miyashita |
|---|
| 51 |
|
|---|
| 52 |
=head1 SEE ALSO |
|---|
| 53 |
|
|---|
| 54 |
L<SVN::Agent> |
|---|
| 55 |
|
|---|
| 56 |
=cut |
|---|
| 57 |
|
|---|