MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / handle_pr_command

Function handle_pr_command

crates/opencode-cli/src/main.rs:2401–2422  ·  view source on GitHub ↗
(number: u32)

Source from the content-addressed store, hash-verified

2399}
2400
2401async fn handle_pr_command(number: u32) -> anyhow::Result<()> {
2402 let branch = format!("pr/{}", number);
2403 let status = ProcessCommand::new("gh")
2404 .args([
2405 "pr",
2406 "checkout",
2407 &number.to_string(),
2408 "--branch",
2409 &branch,
2410 "--force",
2411 ])
2412 .status()
2413 .map_err(|e| anyhow::anyhow!("Failed to run gh pr checkout: {}", e))?;
2414 if !status.success() {
2415 anyhow::bail!(
2416 "Failed to checkout PR #{}. Ensure gh is installed and authenticated.",
2417 number
2418 );
2419 }
2420 println!("Checked out PR #{} as branch {}", number, branch);
2421 Ok(())
2422}
2423
2424#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2425enum InstallMethod {

Callers 1

mainFunction · 0.85

Calls 3

newFunction · 0.85
statusMethod · 0.45
successMethod · 0.45

Tested by

no test coverage detected