protected function execute(InputInterface $input, OutputInterface $output)
{
$branch = $input->getArgument('branch') ?: $this->getHelper('git')->getActiveBranchName();
try {
$latestTag = $this->getHelper('git')->getLastTagOnBranch($branch);
} catch (\RuntimeException $e) {
$this->getHelper('gush_style')->note(sprintf('No tags were found on branch "%s".', $branch));
return self::COMMAND_SUCCESS;
}
$adapter = $this->getIssueTracker();
$commits = $this->getHelper('git')->getLogBetweenCommits($latestTag, $branch);
$issues = $this->getIssuesFromCommits($commits, $input->getOption('search'));
foreach ($issues as $id => $idLabel) {
// ignore missing issues
try {
$issue = $adapter->getIssue($id);
} catch (\Exception $e) {
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()), OutputInterface::VERBOSITY_DEBUG);
continue;
}
$output->writeln(sprintf('%s: %s <info>%s</info>', $idLabel, $issue['title'], $issue['url']));
}
return self::COMMAND_SUCCESS;
}