MCPcopy Index your code
hub / github.com/emwalker/digraph / request_decision

Method request_decision

backend/src/git/topic.rs:575–608  ·  view source on GitHub ↗
(
        &self,
        mutation: Mutation,
        parent: RepoTopic,
        matches: BTreeSet<SynonymMatch>,
    )

Source from the content-addressed store, hash-verified

573 }
574
575 fn request_decision(
576 &self,
577 mutation: Mutation,
578 parent: RepoTopic,
579 matches: BTreeSet<SynonymMatch>,
580 ) -> Result<UpsertTopicResult> {
581 log::info!("topic '{}' exists and OnMatchingSynonym::Ask", self.name);
582
583 let alert = Alert::Success(format!(
584 r#"One or more existing topics with a synonym of "{}" were found. Would you like to
585 add one of the matching topics to the parent topic we're looking at, or would you like
586 to create a new subtopic with the same name?"#,
587 self.name
588 ));
589
590 let parent_id = &parent.topic_id();
591 let mut matching_repo_topics: BTreeSet<SynonymMatch> = BTreeSet::new();
592
593 for synonym_match in matches {
594 let topic_id = &synonym_match.repo_topic.topic_id();
595 if mutation.cycle_exists(self.repo_id, topic_id, parent_id)? {
596 matching_repo_topics.insert(synonym_match.with_cycle(true));
597 } else {
598 matching_repo_topics.insert(synonym_match);
599 }
600 }
601
602 Ok(UpsertTopicResult {
603 alerts: vec![alert],
604 matching_repo_topics,
605 repo_topic: None,
606 saved: false,
607 })
608 }
609
610 fn add_repo_topic<S>(
611 &self,

Callers 1

callMethod · 0.80

Calls 4

cycle_existsMethod · 0.80
insertMethod · 0.80
with_cycleMethod · 0.80
topic_idMethod · 0.45

Tested by

no test coverage detected