diff options
Diffstat (limited to 'src/sub_commands/prs')
| -rw-r--r-- | src/sub_commands/prs/create.rs | 16 | ||||
| -rw-r--r-- | src/sub_commands/prs/list.rs | 6 |
2 files changed, 5 insertions, 17 deletions
diff --git a/src/sub_commands/prs/create.rs b/src/sub_commands/prs/create.rs index 82824a1..8506303 100644 --- a/src/sub_commands/prs/create.rs +++ b/src/sub_commands/prs/create.rs | |||
| @@ -103,7 +103,7 @@ pub async fn launch( | |||
| 103 | let repo_ref = repo_ref::fetch( | 103 | let repo_ref = repo_ref::fetch( |
| 104 | &git_repo, | 104 | &git_repo, |
| 105 | git_repo | 105 | git_repo |
| 106 | .get_root_commit(&to_branch) | 106 | .get_root_commit() |
| 107 | .context("failed to get root commit of the repository")? | 107 | .context("failed to get root commit of the repository")? |
| 108 | .to_string(), | 108 | .to_string(), |
| 109 | &client, | 109 | &client, |
| @@ -111,15 +111,8 @@ pub async fn launch( | |||
| 111 | ) | 111 | ) |
| 112 | .await?; | 112 | .await?; |
| 113 | 113 | ||
| 114 | let events = generate_pr_and_patch_events( | 114 | let events = |
| 115 | &title, | 115 | generate_pr_and_patch_events(&title, &description, &git_repo, &ahead, &keys, &repo_ref)?; |
| 116 | &description, | ||
| 117 | &to_branch, | ||
| 118 | &git_repo, | ||
| 119 | &ahead, | ||
| 120 | &keys, | ||
| 121 | &repo_ref, | ||
| 122 | )?; | ||
| 123 | 116 | ||
| 124 | println!( | 117 | println!( |
| 125 | "posting 1 pull request with {} commits...", | 118 | "posting 1 pull request with {} commits...", |
| @@ -315,14 +308,13 @@ pub static PATCH_KIND: u64 = 1617; | |||
| 315 | pub fn generate_pr_and_patch_events( | 308 | pub fn generate_pr_and_patch_events( |
| 316 | title: &str, | 309 | title: &str, |
| 317 | description: &str, | 310 | description: &str, |
| 318 | to_branch: &str, | ||
| 319 | git_repo: &Repo, | 311 | git_repo: &Repo, |
| 320 | commits: &Vec<Sha1Hash>, | 312 | commits: &Vec<Sha1Hash>, |
| 321 | keys: &nostr::Keys, | 313 | keys: &nostr::Keys, |
| 322 | repo_ref: &RepoRef, | 314 | repo_ref: &RepoRef, |
| 323 | ) -> Result<Vec<nostr::Event>> { | 315 | ) -> Result<Vec<nostr::Event>> { |
| 324 | let root_commit = git_repo | 316 | let root_commit = git_repo |
| 325 | .get_root_commit(to_branch) | 317 | .get_root_commit() |
| 326 | .context("failed to get root commit of the repository")?; | 318 | .context("failed to get root commit of the repository")?; |
| 327 | 319 | ||
| 328 | let mut pr_tags = vec![ | 320 | let mut pr_tags = vec![ |
diff --git a/src/sub_commands/prs/list.rs b/src/sub_commands/prs/list.rs index 96004d4..88b325b 100644 --- a/src/sub_commands/prs/list.rs +++ b/src/sub_commands/prs/list.rs | |||
| @@ -27,12 +27,8 @@ pub async fn launch( | |||
| 27 | ) -> Result<()> { | 27 | ) -> Result<()> { |
| 28 | let git_repo = Repo::discover().context("cannot find a git repository")?; | 28 | let git_repo = Repo::discover().context("cannot find a git repository")?; |
| 29 | 29 | ||
| 30 | let (main_or_master_branch_name, _) = git_repo | ||
| 31 | .get_main_or_master_branch() | ||
| 32 | .context("no main or master branch")?; | ||
| 33 | |||
| 34 | let root_commit = git_repo | 30 | let root_commit = git_repo |
| 35 | .get_root_commit(main_or_master_branch_name) | 31 | .get_root_commit() |
| 36 | .context("failed to get root commit of the repository")?; | 32 | .context("failed to get root commit of the repository")?; |
| 37 | 33 | ||
| 38 | // TODO: check for empty repo | 34 | // TODO: check for empty repo |