this repo has no description

include log in output and template

+43 -29
+43 -29
src/main.rs
··· 374 374 })?; 375 375 pulls[idx] = updated; 376 376 } 377 - } else if Confirm::new() 378 - .with_prompt(format!( 379 - "PR from {target} <- {branch} doesn't exist. Do you want to create it?" 380 - )) 381 - .default(true) 382 - .interact()? 383 - { 384 - let repo_pulls = octocrab.pulls(&repo_info.owner, &repo_info.name); 377 + } else { 378 + let mut command = std::process::Command::new("jj"); 379 + command.args(["log", "-r", &format!("{target}::{branch}")]); 380 + command.spawn()?.wait()?; 381 + if Confirm::new() 382 + .with_prompt(format!( 383 + "PR from {target} <- {branch} doesn't exist. Do you want to create it?" 384 + )) 385 + .default(true) 386 + .interact()? 387 + { 388 + let repo_pulls = octocrab.pulls(&repo_info.owner, &repo_info.name); 385 389 386 - let pull = if let Some((title, body)) = get_pr_title_and_body(branch, target)? { 387 - repo_pulls.create(title, branch, target).body(body) 388 - } else { 389 - repo_pulls.create(branch, branch, target) 390 - } 391 - .draft(true) 392 - .send() 393 - .await 394 - .with_context(|| format!("failed to create PR from {target} <- {branch}"))?; 390 + let pull = if let Some((title, body)) = get_pr_title_and_body(branch, target)? { 391 + repo_pulls.create(title, branch, target).body(body) 392 + } else { 393 + repo_pulls.create(branch, branch, target) 394 + } 395 + .draft(true) 396 + .send() 397 + .await 398 + .with_context(|| format!("failed to create PR from {target} <- {branch}"))?; 395 399 396 - if let Some(url) = &pull.html_url { 397 - eprintln!("Created PR from {target} <- {branch}: {url}"); 400 + if let Some(url) = &pull.html_url { 401 + eprintln!("Created PR from {target} <- {branch}: {url}"); 402 + } else { 403 + eprintln!("Created PR from {target} <- {branch}"); 404 + } 405 + pulls.push(pull); 398 406 } else { 399 - eprintln!("Created PR from {target} <- {branch}"); 407 + eprintln!("skipping creating PR from {target} <- {branch}"); 400 408 } 401 - pulls.push(pull); 402 - } else { 403 - eprintln!("skipping creating PR from {target} <- {branch}"); 404 409 } 405 410 406 411 Ok(()) ··· 494 499 let body = std::fs::read_to_string(".github/pull_request_template.md") 495 500 .unwrap_or_else(|_| "...and description here".to_owned()); 496 501 502 + let log = command( 503 + "jj", 504 + [ 505 + "log", 506 + "--color", 507 + "never", 508 + "-r", 509 + &format!("{target}..{branch}"), 510 + "-T", 511 + "builtin_log_detailed", 512 + ], 513 + )?; 514 + 497 515 let diff = command( 498 516 "jj", 499 517 ["diff", "--git", "-r", &format!("{target}..{branch}")], ··· 529 547 writeln!(&mut template)?; 530 548 writeln!(&mut template)?; 531 549 writeln!(&mut template, "JJ: {ignored_marker}")?; 532 - if count != 1 { 533 - writeln!(&mut template)?; 534 - write!(&mut template, "{commit_descriptions}")?; 535 - } 550 + writeln!(&mut template)?; 551 + writeln!(&mut template, "{log}")?; 536 552 if !diff.trim().is_empty() { 537 - writeln!(&mut template)?; 538 - writeln!(&mut template)?; 539 553 writeln!(&mut template, "{diff}")?; 540 554 } 541 555