MCPcopy Create free account
hub / github.com/douglance/devsql / populate

Method populate

crates/vcsql/src/providers/commit_parents.rs:13–34  ·  view source on GitHub ↗
(&self, conn: &Connection, repo: &mut GitRepo)

Source from the content-addressed store, hash-verified

11 }
12
13 fn populate(&self, conn: &Connection, repo: &mut GitRepo) -> Result<()> {
14 let mut stmt = conn.prepare(
15 r#"
16 INSERT INTO commit_parents (commit_id, parent_id, parent_index, repo)
17 VALUES (?1, ?2, ?3, ?4)
18 "#,
19 )?;
20
21 let repo_path = repo.path().to_string();
22
23 for commit_result in repo.walk_commits()? {
24 let commit = commit_result?;
25 let commit_id = commit.id().to_string();
26
27 for (index, parent) in commit.parents().enumerate() {
28 let parent_id = parent.id().to_string();
29 stmt.execute((&commit_id, &parent_id, index as i64, &repo_path))?;
30 }
31 }
32
33 Ok(())
34 }
35}

Callers

nothing calls this directly

Calls 3

pathMethod · 0.80
walk_commitsMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected