Permalink
Browse files

Add `is_reworked` to Change.

  • Loading branch information...
1 parent 656f6e1 commit 1def3551409a771da06806c8c646e21d319085b9 @theory committed Jan 4, 2013
Showing with 12 additions and 2 deletions.
  1. +1 −0 Changes
  2. +1 −1 lib/App/Sqitch/Engine.pm
  3. +6 −0 lib/App/Sqitch/Plan/Change.pm
  4. +4 −1 t/change.t
View
@@ -4,6 +4,7 @@ Revision history for Perl extension App::Sqitch
- Fixed double "@" displayed for tags in the output of `revert`.
- Fixed reversion of reworked changes to run the original revert script,
rather than the reworked script.
+ - Added `is_reworked` accessor to App::Sqitch::Plan::Change.
0.950 2013-01-03T23:09:42Z
- Fixed the "Name" header in `sqitch-rebase` so that it will actually
View
@@ -378,7 +378,7 @@ sub _verify_changes {
$errs++;
}
# Is it reworked?
- $reworked = !! $plan->change_at($plan_index)->suffix;
+ $reworked = $plan->change_at($plan_index)->is_reworked;
} else {
$sqitch->comment(__ 'Not present in the plan');
$errs++;
@@ -56,6 +56,8 @@ has suffix => (
default => '',
);
+sub is_reworked { length shift->suffix }
+
after suffix => sub {
my $self = shift;
# Need to reset the file name if a new value is passed.
@@ -341,6 +343,10 @@ planner in the file.
Suffix to append to file names, if any. Used for reworked changes.
+=head3 C<is_reworked>
+
+Boolean indicting whether or not the change has been reworked.
+
=head3 C<info>
Information about the change, returned as a string. Includes the change ID,
View
@@ -4,7 +4,7 @@ use strict;
use warnings;
use 5.010;
use utf8;
-use Test::More tests => 77;
+use Test::More tests => 79;
#use Test::More 'no_plan';
use Test::NoWarnings;
use App::Sqitch;
@@ -41,6 +41,7 @@ can_ok $CLASS, qw(
parent
since_tag
suffix
+ is_reworked
tags
add_tag
plan
@@ -89,7 +90,9 @@ is $change->revert_file, $sqitch->revert_dir->file('foo.sql'),
'The revert file should be correct';
is $change->verify_file, $sqitch->verify_dir->file('foo.sql'),
'The verify file should be correct';
+ok !$change->is_reworked, 'The change should not be reworked';
ok $change->suffix('@foo'), 'Set the suffix';
+ok $change->is_reworked, 'The change should be reworked';
is_deeply [ $change->path_segments ], ['foo@foo.sql'],
'path_segments should now include suffix';

0 comments on commit 1def355

Please sign in to comment.