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

Method cycle_exists

backend/src/git/client.rs:137–157  ·  view source on GitHub ↗

How to handle path visibility?

(
        &self,
        repo_id: RepoId,
        descendant_id: &ExternalId,
        ancestor_id: &ExternalId,
    )

Source from the content-addressed store, hash-verified

135
136 // How to handle path visibility?
137 fn cycle_exists(
138 &self,
139 repo_id: RepoId,
140 descendant_id: &ExternalId,
141 ancestor_id: &ExternalId,
142 ) -> Result<bool> {
143 let mut i = 0;
144
145 if let Some(descendant_path) = self.topic_path(repo_id, descendant_id)? {
146 for topic in self.topic_downset(&descendant_path) {
147 i += 1;
148 if topic.topic_id() == ancestor_id {
149 log::info!("cycle found after {} iterations", i);
150 return Ok(true);
151 }
152 }
153 }
154
155 log::info!("no cycle found after {} iterations", i);
156 Ok(false)
157 }
158
159 pub fn downset(&self, topic_path: &TopicPath) -> DownsetIter<'_> {
160 DownsetIter::new(

Callers 3

validateMethod · 0.80
request_decisionMethod · 0.80
update_repo_topicMethod · 0.80

Calls 3

topic_pathMethod · 0.80
topic_downsetMethod · 0.80
topic_idMethod · 0.45

Tested by

no test coverage detected