diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sub_commands/list.rs | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/sub_commands/list.rs b/src/sub_commands/list.rs index fbf04a9..6c620ad 100644 --- a/src/sub_commands/list.rs +++ b/src/sub_commands/list.rs | |||
| @@ -369,6 +369,7 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> { | |||
| 369 | }; | 369 | }; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | // new proposal revision / rebase | ||
| 372 | // tip of local in proposal history (new, ammended or rebased version but no | 373 | // tip of local in proposal history (new, ammended or rebased version but no |
| 373 | // local changes) | 374 | // local changes) |
| 374 | if commits_events.iter().any(|patch| { | 375 | if commits_events.iter().any(|patch| { |
| @@ -436,43 +437,42 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> { | |||
| 436 | }; | 437 | }; |
| 437 | } | 438 | } |
| 438 | 439 | ||
| 439 | // TODO: write tests | ||
| 440 | // tip of proposal in branch in history (local appendments made to up-to-date | 440 | // tip of proposal in branch in history (local appendments made to up-to-date |
| 441 | // proposal) | 441 | // proposal) |
| 442 | if let Ok((local_ahead_of_proposal, _)) = | 442 | if let Ok((local_ahead_of_proposal, _)) = |
| 443 | git_repo.get_commits_ahead_behind(&proposal_tip, &local_branch_tip) | 443 | git_repo.get_commits_ahead_behind(&proposal_tip, &local_branch_tip) |
| 444 | { | 444 | { |
| 445 | println!( | 445 | println!( |
| 446 | "local proposal branch exists with {} unpublished commits on top of the most up-to-date version of the proposal", | 446 | "local proposal branch exists with {} unpublished commits on top of the most up-to-date version of the proposal ({} ahead {} behind '{main_branch_name}')", |
| 447 | local_ahead_of_proposal.len() | 447 | local_ahead_of_proposal.len(), |
| 448 | local_ahead_of_main.len(), | ||
| 449 | proposal_behind_main.len(), | ||
| 448 | ); | 450 | ); |
| 449 | return match Interactor::default().choice( | 451 | return match Interactor::default().choice( |
| 450 | PromptChoiceParms::default().with_default(0) | 452 | PromptChoiceParms::default() |
| 451 | .with_choices( | 453 | .with_default(0) |
| 452 | vec![ | 454 | .with_choices(vec![ |
| 453 | format!( | ||
| 454 | "checkout proposal branch with {} unpublished commits ({} ahead {} behind '{main_branch_name}')", | ||
| 455 | local_ahead_of_proposal.len(), | ||
| 456 | local_ahead_of_main.len(), | ||
| 457 | proposal_behind_main.len(), | ||
| 458 | ), | ||
| 459 | "back".to_string(), | ||
| 460 | ], | ||
| 461 | ) | ||
| 462 | )? { | ||
| 463 | 0 => { | ||
| 464 | git_repo.checkout(&cover_letter.branch_name)?; | ||
| 465 | format!( | 455 | format!( |
| 466 | "checked out proposal branch with {} unpublished commits ({} ahead {} behind '{main_branch_name}')", | 456 | "checkout proposal branch with {} unpublished commits", |
| 467 | local_ahead_of_proposal.len(), | 457 | local_ahead_of_proposal.len(), |
| 468 | local_ahead_of_main.len(), | 458 | ), |
| 469 | proposal_behind_main.len(), | 459 | "back".to_string(), |
| 470 | ); | 460 | ]), |
| 471 | Ok(()) | 461 | )? { |
| 472 | 462 | 0 => { | |
| 473 | }, | 463 | git_repo.checkout(&cover_letter.branch_name)?; |
| 474 | 1 => { continue }, | 464 | println!( |
| 475 | _ => { bail!("unexpected choice")} | 465 | "checked out proposal branch with {} unpublished commits ({} ahead {} behind '{main_branch_name}')", |
| 466 | local_ahead_of_proposal.len(), | ||
| 467 | local_ahead_of_main.len(), | ||
| 468 | proposal_behind_main.len(), | ||
| 469 | ); | ||
| 470 | Ok(()) | ||
| 471 | } | ||
| 472 | 1 => continue, | ||
| 473 | _ => { | ||
| 474 | bail!("unexpected choice") | ||
| 475 | } | ||
| 476 | }; | 476 | }; |
| 477 | } | 477 | } |
| 478 | 478 | ||
| @@ -516,7 +516,7 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> { | |||
| 516 | 0 => { | 516 | 0 => { |
| 517 | check_clean(&git_repo)?; | 517 | check_clean(&git_repo)?; |
| 518 | git_repo.checkout(&cover_letter.branch_name)?; | 518 | git_repo.checkout(&cover_letter.branch_name)?; |
| 519 | format!( | 519 | println!( |
| 520 | "checked out old proposal in existing branch ({} ahead {} behind '{main_branch_name}')", | 520 | "checked out old proposal in existing branch ({} ahead {} behind '{main_branch_name}')", |
| 521 | local_ahead_of_main.len(), | 521 | local_ahead_of_main.len(), |
| 522 | local_beind_main.len(), | 522 | local_beind_main.len(), |
| @@ -531,7 +531,7 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> { | |||
| 531 | let _ = git_repo | 531 | let _ = git_repo |
| 532 | .apply_patch_chain(&cover_letter.branch_name, most_recent_proposal_patch_chain) | 532 | .apply_patch_chain(&cover_letter.branch_name, most_recent_proposal_patch_chain) |
| 533 | .context("cannot apply patch chain")?; | 533 | .context("cannot apply patch chain")?; |
| 534 | format!( | 534 | println!( |
| 535 | "checked out new version of proposal ({} ahead {} behind '{main_branch_name}'), replacing old version ({} ahead {} behind '{main_branch_name}')", | 535 | "checked out new version of proposal ({} ahead {} behind '{main_branch_name}'), replacing old version ({} ahead {} behind '{main_branch_name}')", |
| 536 | chain_length, | 536 | chain_length, |
| 537 | proposal_behind_main.len(), | 537 | proposal_behind_main.len(), |
| @@ -596,7 +596,7 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> { | |||
| 596 | 0 => { | 596 | 0 => { |
| 597 | check_clean(&git_repo)?; | 597 | check_clean(&git_repo)?; |
| 598 | git_repo.checkout(&cover_letter.branch_name)?; | 598 | git_repo.checkout(&cover_letter.branch_name)?; |
| 599 | format!( | 599 | println!( |
| 600 | "checked out old proposal in existing branch ({} ahead {} behind '{main_branch_name}')", | 600 | "checked out old proposal in existing branch ({} ahead {} behind '{main_branch_name}')", |
| 601 | local_ahead_of_main.len(), | 601 | local_ahead_of_main.len(), |
| 602 | local_beind_main.len(), | 602 | local_beind_main.len(), |
| @@ -611,7 +611,7 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> { | |||
| 611 | let _ = git_repo | 611 | let _ = git_repo |
| 612 | .apply_patch_chain(&cover_letter.branch_name, most_recent_proposal_patch_chain) | 612 | .apply_patch_chain(&cover_letter.branch_name, most_recent_proposal_patch_chain) |
| 613 | .context("cannot apply patch chain")?; | 613 | .context("cannot apply patch chain")?; |
| 614 | format!( | 614 | println!( |
| 615 | "checked out new version of proposal ({} ahead {} behind '{main_branch_name}'), replacing old version ({} ahead {} behind '{main_branch_name}'). consider creating a temporary branch with your existing unchanges first.", | 615 | "checked out new version of proposal ({} ahead {} behind '{main_branch_name}'), replacing old version ({} ahead {} behind '{main_branch_name}'). consider creating a temporary branch with your existing unchanges first.", |
| 616 | chain_length, | 616 | chain_length, |
| 617 | proposal_behind_main.len(), | 617 | proposal_behind_main.len(), |