}
close $old_fh;
}
-my ($old_task_revision) = $old_task_version =~ /([0-9]+)$/;
-my $new_task_version = version->parse($target_version)->normal;
-my $new_task_revision = $old_task_revision;
-if (!$opts{n}
- and version->parse($new_task_version) <= version->parse($old_task_version)) {
- ++$new_task_revision;
-}
-if (($target_version =~ tr/.//) < 2) {
- my @components = split /\./, $new_task_version;
- $components[2] = $new_task_revision;
- $new_task_version = join '.', @components;
+my $new_task_version;
+
+if ($opts{n}) {
+ $new_task_version = $old_task_version;
} else {
- $new_task_version .= ".$new_task_revision";
+ my ($old_target_version, $old_task_revision)
+ = $old_task_version =~ /(.*)\.([0-9]+)$/;
+ my $new_task_revision;
+ if (version->parse($target_version) > version->parse($old_target_version)) {
+ $new_task_revision = 0;
+ } else {
+ $new_task_revision = $old_task_revision + 1;
+ }
+ $new_task_version = version->parse($target_version)->normal;
+ if (($target_version =~ tr/.//) < 2) {
+ my @components = split /\./, $new_task_version;
+ $components[2] = $new_task_revision;
+ $new_task_version = join '.', @components;
+ } else {
+ $new_task_version .= ".$new_task_revision";
+ }
}
(my $bug_queue = $task_pkg) =~ s/::/-/g;