From aa9d212ea1bcc00bad0329e6a43b279113f5f35e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 24 Mar 2026 17:01:17 +0000
Subject: [PATCH 1/2] Initial plan
From a6f2c2fd2dacb9df4c837f65a55bfb67d209a3b6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 24 Mar 2026 17:14:01 +0000
Subject: [PATCH 2/2] feat: auto-select branch when only one issue branch
exists in issue:checkout
Co-authored-by: mglaman <3698644+mglaman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/mglaman/drupalorg-cli/sessions/fca71fd2-9aa3-4709-9cb7-b188180555e7
---
src/Cli/Command/Issue/Checkout.php | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/Cli/Command/Issue/Checkout.php b/src/Cli/Command/Issue/Checkout.php
index 170f25f..ebe342d 100644
--- a/src/Cli/Command/Issue/Checkout.php
+++ b/src/Cli/Command/Issue/Checkout.php
@@ -96,20 +96,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->stdErr->writeln('No branches found for this issue on the fork.');
return 1;
}
- if (!self::$interactive) {
+ if (count($issueBranches) === 1) {
+ $branchArg = $issueBranches[0];
+ $this->stdOut->writeln(sprintf('Auto-selected branch %s.', $branchArg));
+ } elseif (!self::$interactive) {
$this->stdErr->writeln('No branch specified. Available branches:');
foreach ($issueBranches as $b) {
$this->stdErr->writeln(' ' . $b);
}
return 1;
+ } else {
+ /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
+ $helper = $this->getHelper('question');
+ $question = new \Symfony\Component\Console\Question\ChoiceQuestion(
+ 'Select a branch to check out:',
+ $issueBranches
+ );
+ $branchArg = $helper->ask($input, $output, $question);
}
- /** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
- $helper = $this->getHelper('question');
- $question = new \Symfony\Component\Console\Question\ChoiceQuestion(
- 'Select a branch to check out:',
- $issueBranches
- );
- $branchArg = $helper->ask($input, $output, $question);
}
$checkoutProcess = new Process([