diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-16 22:31:29 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-16 22:31:29 +0000 |
| commit | 701668b02d999af42f51d8bd25fffb2a8692c3c8 (patch) | |
| tree | 7defd0e7e711d743c8464994c2223a7a332ccf2a /src/sub_commands/pull.rs | |
| parent | 61ffbf2008c0aaaee3d19ac027d63bca823dc8c9 (diff) | |
refactor: rename PR to proposal
PR is a problematic term when it ambiguous whether the
set of patches are PR-like or email-patch like.
Diffstat (limited to 'src/sub_commands/pull.rs')
| -rw-r--r-- | src/sub_commands/pull.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/sub_commands/pull.rs b/src/sub_commands/pull.rs index fc6db37..de078e3 100644 --- a/src/sub_commands/pull.rs +++ b/src/sub_commands/pull.rs | |||
| @@ -9,7 +9,8 @@ use crate::{ | |||
| 9 | git::{Repo, RepoActions}, | 9 | git::{Repo, RepoActions}, |
| 10 | repo_ref, | 10 | repo_ref, |
| 11 | sub_commands::{ | 11 | sub_commands::{ |
| 12 | list::get_most_recent_patch_with_ancestors, push::fetch_pr_and_most_recent_patch_chain, | 12 | list::get_most_recent_patch_with_ancestors, |
| 13 | push::fetch_proposal_root_and_most_recent_patch_chain, | ||
| 13 | }, | 14 | }, |
| 14 | }; | 15 | }; |
| 15 | 16 | ||
| @@ -29,7 +30,7 @@ pub async fn launch() -> Result<()> { | |||
| 29 | .context("cannot get checked out branch name")?; | 30 | .context("cannot get checked out branch name")?; |
| 30 | 31 | ||
| 31 | if branch_name == main_or_master_branch_name { | 32 | if branch_name == main_or_master_branch_name { |
| 32 | bail!("checkout a branch associated with a PR first") | 33 | bail!("checkout a branch associated with a proposal first") |
| 33 | } | 34 | } |
| 34 | #[cfg(not(test))] | 35 | #[cfg(not(test))] |
| 35 | let client = Client::default(); | 36 | let client = Client::default(); |
| @@ -44,19 +45,23 @@ pub async fn launch() -> Result<()> { | |||
| 44 | ) | 45 | ) |
| 45 | .await?; | 46 | .await?; |
| 46 | 47 | ||
| 47 | let (_pr_event, commit_events) = | 48 | let (_proposal_root_event, commit_events) = fetch_proposal_root_and_most_recent_patch_chain( |
| 48 | fetch_pr_and_most_recent_patch_chain(&client, &repo_ref, &root_commit, &branch_name) | 49 | &client, |
| 49 | .await?; | 50 | &repo_ref, |
| 51 | &root_commit, | ||
| 52 | &branch_name, | ||
| 53 | ) | ||
| 54 | .await?; | ||
| 50 | 55 | ||
| 51 | if git_repo.has_outstanding_changes()? { | 56 | if git_repo.has_outstanding_changes()? { |
| 52 | bail!("cannot pull changes when repository is not clean. discard changes and try again."); | 57 | bail!("cannot pull changes when repository is not clean. discard changes and try again."); |
| 53 | } | 58 | } |
| 54 | 59 | ||
| 55 | let most_recent_pr_patch_chain = get_most_recent_patch_with_ancestors(commit_events) | 60 | let most_recent_proposal_patch_chain = get_most_recent_patch_with_ancestors(commit_events) |
| 56 | .context("cannot get most recent patch for PR")?; | 61 | .context("cannot get most recent patch for proposal")?; |
| 57 | 62 | ||
| 58 | let applied = git_repo | 63 | let applied = git_repo |
| 59 | .apply_patch_chain(&branch_name, most_recent_pr_patch_chain) | 64 | .apply_patch_chain(&branch_name, most_recent_proposal_patch_chain) |
| 60 | .context("cannot apply patch chain")?; | 65 | .context("cannot apply patch chain")?; |
| 61 | 66 | ||
| 62 | if applied.is_empty() { | 67 | if applied.is_empty() { |