diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2023-05-21 11:21:01 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2023-05-21 11:21:01 +0000 |
| commit | 6f44c872a347907737cc1d2f9e49da201142044e (patch) | |
| tree | 28d7e56ddd396b7a40d3b1c2bd83e2509f848228 /src/merge.rs | |
| parent | a579e90666d49a0f9353319525b1790ad7b26c4a (diff) | |
merge, patch, pull requests and repo_config
Diffstat (limited to 'src/merge.rs')
| -rw-r--r-- | src/merge.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/merge.rs b/src/merge.rs new file mode 100644 index 0000000..5f5b15f --- /dev/null +++ b/src/merge.rs | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | use nostr::{Event, EventBuilder, Keys }; | ||
| 2 | |||
| 3 | |||
| 4 | use crate::{ngit_tag::{tag_repo, tag_branch, tag_commit, tag_branch_merge_from, tag_patch, tag_hashtag, tag_into_event}, kind::Kind}; | ||
| 5 | |||
| 6 | pub fn initialize_merge( | ||
| 7 | keys: &Keys, | ||
| 8 | repoistory:&String, | ||
| 9 | to_branch_id: &String, | ||
| 10 | from_branch_id: &String, | ||
| 11 | commit_id: &String, | ||
| 12 | patch_id: &String, | ||
| 13 | ) -> Event { | ||
| 14 | let tags = vec![ | ||
| 15 | tag_repo(repoistory), | ||
| 16 | tag_into_event(tag_repo(repoistory)), | ||
| 17 | tag_branch(to_branch_id), | ||
| 18 | tag_into_event(tag_branch(to_branch_id)), | ||
| 19 | tag_branch_merge_from(from_branch_id), | ||
| 20 | tag_into_event(tag_branch_merge_from(from_branch_id)), | ||
| 21 | tag_patch(patch_id), | ||
| 22 | tag_into_event(tag_patch(patch_id)), | ||
| 23 | tag_commit(commit_id), | ||
| 24 | tag_hashtag("ngit-event"), | ||
| 25 | tag_hashtag("ngit-format-0.0.1"), | ||
| 26 | ]; | ||
| 27 | EventBuilder::new( | ||
| 28 | Kind::Merge.into_sdk_custom_kind(), | ||
| 29 | "MERGE", | ||
| 30 | &tags, | ||
| 31 | ) | ||
| 32 | .to_unsigned_event(keys.public_key()) | ||
| 33 | .sign(&keys) | ||
| 34 | .unwrap() | ||
| 35 | } | ||