Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close #54: Make sure all commands return a value of the type int #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Command/Apply.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
print strtr("You should now commit this, using the command from the issue on drupal.org: https://www.drupal.org/node/!id#drupalorg-issue-credit-form.\n", [
'!id' => $this->analyser->deduceIssueNumber(),
]);

return 0;
}

}
4 changes: 3 additions & 1 deletion Command/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {

if ($confirmation != 'delete') {
print "Clean up aborted.\n";
return;
return 1;
}

$master_branch_name = $master_branch->getBranchName();
Expand All @@ -59,6 +59,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
shell_exec("git branch -D $feature_branch_name");

// TODO: delete any patch files for this issue.

return 0;
}

}
2 changes: 2 additions & 0 deletions Command/CreatePatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// Make an empty commit to record the patch.
$local_patch_commit_message = $this->commit_message->createLocalCommitMessage($local_patch);
$this->git_executor->commit($local_patch_commit_message);

return 0;
}

protected function getInterdiffName($feature_branch, $last_patch) {
Expand Down
2 changes: 2 additions & 0 deletions Command/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$diff = $this->git_info->diffMasterBranch($master_branch->getBranchName());

$io->text($diff);

return 0;
}

}
6 changes: 4 additions & 2 deletions Command/LocalSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln("Afterwards, you should use the update command to get new patches from drupal.org.");
}

return;
return 0;
}

// If the master branch is not current, abort.
Expand All @@ -89,7 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// If no patches, we're done.
if (empty($patches)) {
$output->writeln("There are no patches to apply.");
return;
return 0;
}

// Output the patches.
Expand Down Expand Up @@ -122,6 +122,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
'!patchname' => $patch->getPatchFilename(),
]));
}

return 0;
}

}
8 changes: 5 additions & 3 deletions Command/LocalUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// If no patches, we're done.
if (empty($patches)) {
print "No patches to apply.\n";
return;
return 0;
}

$patches_uncommitted = [];
Expand All @@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// If no uncommitted patches, we're done.
if (empty($patches_uncommitted)) {
print "No patches to apply; existing patches are already applied to this feature branch.\n";
return;
return 0;
}

// If the feature branch's SHA is not the same as the last committed patch
Expand Down Expand Up @@ -134,7 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// If all the patches were already committed, we're done.
if (empty($patches_committed)) {
print "No new patches to apply.\n";
return;
return 0;
}

// If final patch didn't apply, then output a message: the latest patch
Expand All @@ -149,6 +149,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
'!patchname' => $patch->getPatchFilename(),
]);
}

return 0;
}

}
6 changes: 4 additions & 2 deletions Command/Purge.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {

if (empty($issues_to_clean_up)) {
print "No branches to clean up.\n";
return;
return 0;
}

// Sort by issue number.
Expand Down Expand Up @@ -102,13 +102,15 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$question = new Question("Please enter 'delete' to confirm DELETION of {$count} branches:");
if ($helper->ask($input, $output, $question) != 'delete') {
$output->writeln('Clean up aborted.');
return;
return 0;
}

foreach ($issues_to_clean_up as $issue_number => $info) {
shell_exec("git branch -D {$info['branch']}");
$output->writeln("Deleted branch {$info['branch']}.");
}

return 0;
}

protected function getIssueCommit($issue_number) {
Expand Down
2 changes: 2 additions & 0 deletions Command/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
if (!$clean) {
$io->text('You have uncommitted changes.');
}

return 0;
}

}
2 changes: 2 additions & 0 deletions Command/SwitchMaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$master_branch = $this->waypoint_manager_branches->getMasterBranch();
$master_branch->gitCheckout();

return 0;
}

}