Skip to content

Commit

Permalink
feat: expose commits in api
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc committed Nov 26, 2024
1 parent 5faeae2 commit 27a9aaa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ pub struct RelatedFileContext {
#[derive(Serialize, Deserialize)]
#[pyclass]
pub struct FileMetadata {
#[pyo3(get)]
pub path: String,

#[pyo3(get)]
pub commits: Vec<String>,

#[pyo3(get)]
pub symbols: Vec<Symbol>,
}
Expand Down Expand Up @@ -123,7 +129,13 @@ impl Graph {
.iter()
.cloned()
.collect();
FileMetadata { symbols }

let commit_sha_list = self._relation_graph.file_related_commits(&file_name).unwrap_or_default();
FileMetadata {
path: file_name,
commits: commit_sha_list,
symbols
}
}

pub fn pairs_between_files(&self, src_file: String, dst_file: String) -> Vec<DefRefPair> {
Expand Down

0 comments on commit 27a9aaa

Please sign in to comment.