From 27a9aaa53afef54735913acb7721edb4c5af89af Mon Sep 17 00:00:00 2001 From: williamfzc <178894043@qq.com> Date: Tue, 26 Nov 2024 23:33:50 +0800 Subject: [PATCH] feat: expose commits in api --- src/api.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/api.rs b/src/api.rs index d34cea0..82d50fd 100644 --- a/src/api.rs +++ b/src/api.rs @@ -21,6 +21,12 @@ pub struct RelatedFileContext { #[derive(Serialize, Deserialize)] #[pyclass] pub struct FileMetadata { + #[pyo3(get)] + pub path: String, + + #[pyo3(get)] + pub commits: Vec, + #[pyo3(get)] pub symbols: Vec, } @@ -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 {