upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/merge.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/merge.rs')
-rw-r--r--src/merge.rs35
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 @@
1use nostr::{Event, EventBuilder, Keys };
2
3
4use crate::{ngit_tag::{tag_repo, tag_branch, tag_commit, tag_branch_merge_from, tag_patch, tag_hashtag, tag_into_event}, kind::Kind};
5
6pub 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}