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

Method update_repo_topic

backend/src/git/topic.rs:660–685  ·  view source on GitHub ↗
(
        &self,
        mutation: Mutation,
        store: &S,
        name: String,
        topic_id: &ExternalId,
        parent: RepoTopic,
        matches: BTreeSet<SynonymMatch>,
    )

Source from the content-addressed store, hash-verified

658 }
659
660 fn update_repo_topic<S>(
661 &self,
662 mutation: Mutation,
663 store: &S,
664 name: String,
665 topic_id: &ExternalId,
666 parent: RepoTopic,
667 matches: BTreeSet<SynonymMatch>,
668 ) -> Result<UpsertTopicResult>
669 where
670 S: SaveChangesForPrefix,
671 {
672 let date = chrono::Utc::now();
673
674 if mutation.cycle_exists(self.repo_id, topic_id, parent.topic_id())? {
675 return self.handle_cycle(mutation, topic_id, parent, matches);
676 }
677
678 log::info!("updating existing topic {:?}", topic_id);
679 let mut topic = self.ensure_topic(&mutation, topic_id);
680 let parent_topics = topic.parent_topics.clone();
681
682 topic.parent_topics.insert(parent.to_parent_topic());
683 topic = append_synonym(topic, &name, self.locale, date);
684 self.persist_repo_topic(mutation, store, topic, parent, parent_topics)
685 }
686
687 fn handle_cycle(
688 &self,

Callers 1

callMethod · 0.80

Calls 8

append_synonymFunction · 0.85
cycle_existsMethod · 0.80
handle_cycleMethod · 0.80
ensure_topicMethod · 0.80
insertMethod · 0.80
to_parent_topicMethod · 0.80
persist_repo_topicMethod · 0.80
topic_idMethod · 0.45

Tested by

no test coverage detected