Skip to content

Commit

Permalink
Getting parents from db
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanBrouwer committed Oct 22, 2023
1 parent d7eb25b commit 611e195
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bencher/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,21 @@ fn check_parents(benches: &Collection<Document>, commit: &Commit, test_data: &Do
for parent in commit.parents(){
let filter = doc!("commits.hash": parent.id().to_string());
let options = None;
if let Some(c) = benches.find_one(filter, options).unwrap() {
dbg!(c);
// todo logic!
if let Some(parent_data) = benches.find_one(filter, options).unwrap() {
let parent_data = parent_data.get_array("commits").unwrap().first().unwrap().as_document().unwrap().get_document("tests").unwrap();
test_data.check(parent_data);
} else{
failure |= check_parents(benches, commit, test_data);
};
}
!failure
}

impl Check for Document{
fn check(&self, other: &Self) -> bool {
todo!()
}
}

fn write_commit(benches: &Collection<Document>, commit: &Commit<'_>, test_data: &Document) {
let hash = commit.id().to_string();
Expand Down

0 comments on commit 611e195

Please sign in to comment.