upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/sub_commands/list.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-02-22 12:15:46 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-02-22 12:15:46 +0000
commit79896914357ee322b08b302c3dde08c7a24a0a09 (patch)
tree287af5d951f682143d5e849e96060a292aaa0d2f /src/sub_commands/list.rs
parentfdc15cb017b022a3b932ac5a337c649cb63df93c (diff)
feat(list): improved copy for rebase scenarios
and added some comments to better describe the rebase scenarios
Diffstat (limited to 'src/sub_commands/list.rs')
-rw-r--r--src/sub_commands/list.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/sub_commands/list.rs b/src/sub_commands/list.rs
index 88ad52f..fbf04a9 100644
--- a/src/sub_commands/list.rs
+++ b/src/sub_commands/list.rs
@@ -436,7 +436,9 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> {
436 }; 436 };
437 } 437 }
438 438
439 // tip of proposal in branch in history (local appendments made) 439 // TODO: write tests
440 // tip of proposal in branch in history (local appendments made to up-to-date
441 // proposal)
440 if let Ok((local_ahead_of_proposal, _)) = 442 if let Ok((local_ahead_of_proposal, _)) =
441 git_repo.get_commits_ahead_behind(&proposal_tip, &local_branch_tip) 443 git_repo.get_commits_ahead_behind(&proposal_tip, &local_branch_tip)
442 { 444 {
@@ -474,6 +476,8 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> {
474 }; 476 };
475 } 477 }
476 478
479 // TODO: write tests
480 // user has probably has an unpublished rebase of the latest proposal version
477 // if tip of proposal commits exist (were once part of branch but have been 481 // if tip of proposal commits exist (were once part of branch but have been
478 // ammended and git clean up job hasn't removed them) 482 // ammended and git clean up job hasn't removed them)
479 if git_repo.does_commit_exist(&proposal_tip.to_string())? { 483 if git_repo.does_commit_exist(&proposal_tip.to_string())? {
@@ -484,6 +488,9 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> {
484 local_ahead_of_main.len(), 488 local_ahead_of_main.len(),
485 local_beind_main.len(), 489 local_beind_main.len(),
486 ); 490 );
491 println!(
492 "if this sounds right then consider publishing your rebase `ngit push --force` or discarding your local branch"
493 );
487 return match Interactor::default().choice( 494 return match Interactor::default().choice(
488 PromptChoiceParms::default().with_default(0) 495 PromptChoiceParms::default().with_default(0)
489 .with_choices( 496 .with_choices(
@@ -540,6 +547,9 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> {
540 }; 547 };
541 } 548 }
542 549
550 // TODO: write tests
551 // user has probaly has an unpublished rebase of an older version of the
552 // proposal
543 println!( 553 println!(
544 "your local proposal branch ({} ahead {} behind '{main_branch_name}') has conflicting changes with the latest published proposal ({} ahead {} behind '{main_branch_name}')", 554 "your local proposal branch ({} ahead {} behind '{main_branch_name}') has conflicting changes with the latest published proposal ({} ahead {} behind '{main_branch_name}')",
545 local_ahead_of_main.len(), 555 local_ahead_of_main.len(),
@@ -547,6 +557,19 @@ pub async fn launch(_cli_args: &Cli, _args: &SubCommandArgs) -> Result<()> {
547 most_recent_proposal_patch_chain.len(), 557 most_recent_proposal_patch_chain.len(),
548 proposal_behind_main.len(), 558 proposal_behind_main.len(),
549 ); 559 );
560 println!(
561 "its likely that you are working off an old proposal version because git has no record of the latest proposal commit."
562 );
563 println!(
564 "it is possible that you have ammended the latest version and git has delete this commit as part of a clean up"
565 );
566
567 println!("to view the latest proposal but retain your changes:");
568 println!(" 1) checkout the local branch");
569 println!(" 2) create a new branch off the tip commit to store your changes");
570 println!(" 3) run `ngit list` and checkout the latest published version of this proposal");
571
572 println!("if you are confident in your changes consider running `ngit push --force`");
550 573
551 return match Interactor::default().choice( 574 return match Interactor::default().choice(
552 PromptChoiceParms::default().with_default(0) 575 PromptChoiceParms::default().with_default(0)