[libcode-tidyall-perl] 135/374: fix tidyall -a
Jonas Smedegaard
js at alioth.debian.org
Sun Sep 29 22:26:04 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libcode-tidyall-perl.
commit e12b9035dca4d88dc6a4a66bcbd1d8afb23c5559
Author: Jonathan Swartz <swartz at pobox.com>
Date: Fri Aug 10 15:27:26 2012 -0700
fix tidyall -a
---
bin/tidyall | 9 +++++----
lib/Code/TidyAll/SVN/Precommit.pm | 17 +++++++++--------
lib/Code/TidyAll/SVN/Util.pm | 6 +++---
lib/Code/TidyAll/t/SVN.pm | 5 +++--
4 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/bin/tidyall b/bin/tidyall
index d59989f..b773ccc 100755
--- a/bin/tidyall
+++ b/bin/tidyall
@@ -48,7 +48,7 @@ $conf_file = "$params{root_dir}/tidyall.ini" if $params{root_dir};
my $tidyall_class = $params{tidyall_class} || 'Code::TidyAll';
-my @results;
+my (@results);
if ( $all_files || $svn_files || $git_files ) {
my $conf_file = $tidyall_class->find_conf_file( cwd() );
my $ct = $tidyall_class->new_from_conf_file( $conf_file, %params );
@@ -58,12 +58,13 @@ if ( $all_files || $svn_files || $git_files ) {
}
elsif ($svn_files) {
require Code::TidyAll::SVN::Util;
- @files = Code::TidyAll::SVN::Util::svn_uncommitted_files($ct->root_dir);
+ @files = Code::TidyAll::SVN::Util::svn_uncommitted_files( $ct->root_dir );
}
elsif ($git_files) {
require Code::TidyAll::Git::Util;
- @files = Code::TidyAll::Git::Util::git_uncommitted_files($ct->root_dir);
+ @files = Code::TidyAll::Git::Util::git_uncommitted_files( $ct->root_dir );
}
+ @results = $ct->process_files(@files);
}
elsif ( my @files = @ARGV ) {
my $conf_file = $tidyall_class->find_conf_file( dirname( $files[0] ) );
@@ -71,7 +72,7 @@ elsif ( my @files = @ARGV ) {
@results = $ct->process_files(@files);
}
else {
- die "must pass -a, -s, -g, or filename(s)";
+ die "must pass -a/--all, -s/--svn, -g/--git, or filename(s)";
}
my $status = ( grep { $_->error } @results ) ? 1 : 0;
diff --git a/lib/Code/TidyAll/SVN/Precommit.pm b/lib/Code/TidyAll/SVN/Precommit.pm
index 3caddbb..7ae6715 100644
--- a/lib/Code/TidyAll/SVN/Precommit.pm
+++ b/lib/Code/TidyAll/SVN/Precommit.pm
@@ -19,7 +19,7 @@ has 'txn' => ( is => 'ro', default => sub { $ARGV[1] } );
# Private
has 'cat_file_cache' => ( init_arg => undef, is => 'ro', default => sub { {} } );
-has 'revlook' => ( init_arg => undef, is => 'lazy' );
+has 'revlook' => ( init_arg => undef, is => 'lazy' );
sub _build_revlook {
my $self = shift;
@@ -32,13 +32,13 @@ sub check {
my $fail_msg;
try {
- my $self = $class->new(%params);
+ my $self = $class->new(%params);
my $revlook = $self->revlook;
# Skip if emergency comment prefix is present
#
- if (my $prefix = $self->emergency_comment_prefix) {
- if (index($revlook->log_msg, $prefix) == 0) {
+ if ( my $prefix = $self->emergency_comment_prefix ) {
+ if ( index( $revlook->log_msg, $prefix ) == 0 ) {
return;
}
}
@@ -204,7 +204,8 @@ commit is rejected and the reason(s) are output to the client. e.g.
at /tmp/Code-TidyAll-0e6K/Driver.pm line 2
[TestingAndDebugging::RequireUseStrict]
-In an emergency the hook can be bypassed by prefixing the comment with "NO TIDYALL", e.g.
+In an emergency the hook can be bypassed by prefixing the comment with "NO
+TIDYALL", e.g.
% svn commit -m "NO TIDYALL - this is an emergency!" CHI.pm CHI/Driver.pm
Sending CHI/Driver.pm
@@ -216,9 +217,9 @@ The configuration file (C<tidyall.ini> by default) must be checked into svn.
For each file, the hook will look upwards from the file's repo location and use
the first configuration file it finds.
-By default, if C<tidyall.ini> cannot be found, or if a runtime error occurs,
-a warning is logged (see L</LOGGING> below) but the commit is allowed to
-proceed. This is so that unexpected problems do not prevent valid commits.
+By default, if C<tidyall.ini> cannot be found, or if a runtime error occurs, a
+warning is logged (see L</LOGGING> below) but the commit is allowed to proceed.
+ This is so that unexpected problems do not prevent valid commits.
Passes mode = "commit" by default; see L<modes|tidyall/MODES>.
diff --git a/lib/Code/TidyAll/SVN/Util.pm b/lib/Code/TidyAll/SVN/Util.pm
index 4b60db7..57d6668 100644
--- a/lib/Code/TidyAll/SVN/Util.pm
+++ b/lib/Code/TidyAll/SVN/Util.pm
@@ -11,9 +11,9 @@ sub svn_uncommitted_files {
my ($dir) = @_;
$dir = realpath($dir);
- my $output = capturex("svn", "status", $dir);
- my @lines = grep { /^[AM]/ } split("\n", $output);
- my (@files) = ($output =~ m{^[AM]\s+(.*)$}gm);
+ my $output = capturex( "svn", "status", $dir );
+ my @lines = grep { /^[AM]/ } split( "\n", $output );
+ my (@files) = ( $output =~ m{^[AM]\s+(.*)$}gm );
return @files;
}
diff --git a/lib/Code/TidyAll/t/SVN.pm b/lib/Code/TidyAll/t/SVN.pm
index e6d0231..cc5c273 100644
--- a/lib/Code/TidyAll/t/SVN.pm
+++ b/lib/Code/TidyAll/t/SVN.pm
@@ -94,8 +94,9 @@ sub test_svn : Tests {
$committed->();
write_file( "$work_dir/foo.txt", "def" );
- $stderr =
- capture_stderr { system( sprintf( 'svn -q commit -m "NO TIDYALL - emergency fix!" %s/foo.txt', $work_dir ) ) };
+ $stderr = capture_stderr {
+ system( sprintf( 'svn -q commit -m "NO TIDYALL - emergency fix!" %s/foo.txt', $work_dir ) );
+ };
unlike( $stderr, qr/\S/ );
$committed->();
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git
More information about the Pkg-perl-cvs-commits
mailing list