MCPcopy Create free account
hub / github.com/emwalker/digraph / make_topic

Method make_topic

backend/src/git/topic.rs:746–775  ·  view source on GitHub ↗
(
        &self,
        parent: &RepoTopic,
        name: String,
    )

Source from the content-addressed store, hash-verified

744 }
745
746 fn make_topic(
747 &self,
748 parent: &RepoTopic,
749 name: String,
750 ) -> Result<(RepoTopic, BTreeSet<ParentTopic>)> {
751 let added = chrono::Utc::now();
752 let id = ExternalId::make();
753 let parent_topics = BTreeSet::from([parent.to_parent_topic()]);
754
755 let topic = RepoTopic {
756 api_version: API_VERSION.into(),
757 metadata: RepoTopicMetadata {
758 added,
759 id,
760 details: Some(RepoTopicDetails {
761 root: false,
762 synonyms: vec![Synonym {
763 added,
764 locale: self.locale.to_owned(),
765 name,
766 }],
767 timerange: None,
768 }),
769 },
770 parent_topics: parent_topics.clone(),
771 children: BTreeSet::new(),
772 };
773
774 Ok((topic, parent_topics))
775 }
776
777 fn ensure_topic(&self, mutation: &Mutation, topic_id: &ExternalId) -> RepoTopic {
778 match mutation.fetch_topic(self.repo_id, topic_id) {

Callers 1

add_repo_topicMethod · 0.80

Calls 1

to_parent_topicMethod · 0.80

Tested by

no test coverage detected