diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-23 16:36:06 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-23 16:36:06 +0100 |
| commit | b67376ff54abeab31422921ba5f4883d5d3dccdb (patch) | |
| tree | d4f4194fdf2d285332dd7aacea31678042389b00 /src/sub_commands/send.rs | |
| parent | 643fa17fde858c2d6f934dcc435eb84843cc172e (diff) | |
feat(list): unique proposal branch names
to prevent accidental name conflicts. also moved to prs/* namespace
`pull` and `push` integration tests are intermitantly failing to end
at least for `push` they work when run individually but not
when run together
Diffstat (limited to 'src/sub_commands/send.rs')
| -rw-r--r-- | src/sub_commands/send.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 33ce104..6b9dd58 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs | |||
| @@ -769,8 +769,22 @@ pub struct CoverLetter { | |||
| 769 | pub title: String, | 769 | pub title: String, |
| 770 | pub description: String, | 770 | pub description: String, |
| 771 | pub branch_name: String, | 771 | pub branch_name: String, |
| 772 | pub event_id: Option<nostr::EventId>, | ||
| 772 | } | 773 | } |
| 773 | 774 | ||
| 775 | impl CoverLetter { | ||
| 776 | pub fn get_branch_name(&self) -> Result<String> { | ||
| 777 | Ok(format!( | ||
| 778 | "prs/{}({})", | ||
| 779 | self.branch_name, | ||
| 780 | &self | ||
| 781 | .event_id | ||
| 782 | .context("proposal root event_id must be know to get it's branch name")? | ||
| 783 | .to_hex() | ||
| 784 | .as_str()[..8], | ||
| 785 | )) | ||
| 786 | } | ||
| 787 | } | ||
| 774 | pub fn event_is_cover_letter(event: &nostr::Event) -> bool { | 788 | pub fn event_is_cover_letter(event: &nostr::Event) -> bool { |
| 775 | // TODO: look for Subject:[ PATCH 0/n ] but watch out for: | 789 | // TODO: look for Subject:[ PATCH 0/n ] but watch out for: |
| 776 | // [PATCH v1 0/n ] or | 790 | // [PATCH v1 0/n ] or |
| @@ -841,6 +855,7 @@ pub fn event_to_cover_letter(event: &nostr::Event) -> Result<CoverLetter> { | |||
| 841 | .collect(); | 855 | .collect(); |
| 842 | s | 856 | s |
| 843 | }, | 857 | }, |
| 858 | event_id: Some(event.id()), | ||
| 844 | }) | 859 | }) |
| 845 | } | 860 | } |
| 846 | 861 | ||