diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2023-11-01 00:00:00 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2023-11-01 00:00:00 +0000 |
| commit | 57321aa9136293b24757a6695a5c92087af539ab (patch) | |
| tree | 2867d02430e346b13f7abcbb1022113d4fac31fa /src/sub_commands/prs/create.rs | |
| parent | 82f1ba360b60c8339c7caea0dec7903ee5e764cd (diff) | |
feat(prs-create) send to repo relays
fetch repository reference events to identify repository relays
send pr events to repository relays alongside user relays
Diffstat (limited to 'src/sub_commands/prs/create.rs')
| -rw-r--r-- | src/sub_commands/prs/create.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/sub_commands/prs/create.rs b/src/sub_commands/prs/create.rs index d82f53e..e85611f 100644 --- a/src/sub_commands/prs/create.rs +++ b/src/sub_commands/prs/create.rs | |||
| @@ -13,7 +13,7 @@ use crate::{ | |||
| 13 | cli_interactor::{Interactor, InteractorPrompt, PromptConfirmParms, PromptInputParms}, | 13 | cli_interactor::{Interactor, InteractorPrompt, PromptConfirmParms, PromptInputParms}, |
| 14 | client::Connect, | 14 | client::Connect, |
| 15 | git::{Repo, RepoActions}, | 15 | git::{Repo, RepoActions}, |
| 16 | login, Cli, | 16 | login, repo_ref, Cli, |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | #[derive(Debug, clap::Args)] | 19 | #[derive(Debug, clap::Args)] |
| @@ -99,11 +99,16 @@ pub async fn launch( | |||
| 99 | let events = | 99 | let events = |
| 100 | generate_pr_and_patch_events(&title, &description, &to_branch, &git_repo, &ahead, &keys)?; | 100 | generate_pr_and_patch_events(&title, &description, &to_branch, &git_repo, &ahead, &keys)?; |
| 101 | 101 | ||
| 102 | // TODO: get relays from repo event | 102 | let repo_ref = repo_ref::fetch( |
| 103 | let repo_read_relays: Vec<String> = vec![ | 103 | git_repo |
| 104 | "ws://localhost:8055".to_string(), | 104 | .get_root_commit(&to_branch) |
| 105 | "ws://localhost:8056".to_string(), | 105 | .context("failed to get root commit of the repository")? |
| 106 | ]; | 106 | .to_string(), |
| 107 | &client, | ||
| 108 | // TODO: get relay list from local yaml file | ||
| 109 | user_ref.relays.write(), | ||
| 110 | ) | ||
| 111 | .await?; | ||
| 107 | 112 | ||
| 108 | println!( | 113 | println!( |
| 109 | "posting 1 pull request with {} commits...", | 114 | "posting 1 pull request with {} commits...", |
| @@ -114,12 +119,11 @@ pub async fn launch( | |||
| 114 | &client, | 119 | &client, |
| 115 | events, | 120 | events, |
| 116 | user_ref.relays.write(), | 121 | user_ref.relays.write(), |
| 117 | repo_read_relays, | 122 | repo_ref.relays.clone(), |
| 118 | !cli_args.disable_cli_spinners, | 123 | !cli_args.disable_cli_spinners, |
| 119 | ) | 124 | ) |
| 120 | .await?; | 125 | .await?; |
| 121 | // TODO check if there is already a similarly named PR | 126 | // TODO check if there is already a similarly named |
| 122 | |||
| 123 | Ok(()) | 127 | Ok(()) |
| 124 | } | 128 | } |
| 125 | 129 | ||
| @@ -212,7 +216,6 @@ pub async fn send_events( | |||
| 212 | } | 216 | } |
| 213 | })) | 217 | })) |
| 214 | .await; | 218 | .await; |
| 215 | client.disconnect().await?; | ||
| 216 | Ok(()) | 219 | Ok(()) |
| 217 | } | 220 | } |
| 218 | 221 | ||