diff --git a/benchmark-new/benchmark_repository/examples/test.rs b/benchmark-new/benchmark_repository/examples/test.rs index 52922f955..241443222 100644 --- a/benchmark-new/benchmark_repository/examples/test.rs +++ b/benchmark-new/benchmark_repository/examples/test.rs @@ -40,7 +40,14 @@ fn main() let instance_domain = instance["domain"].as_str().unwrap(); let instance_number = instance["instance"].as_i64().unwrap(); - println!("[{}, {}, {}/{}/{}]", configuration_id, instance_set_id, instance_ipc, instance_domain, instance_number); + let file_name = format!("{}/{}/{}", instance_ipc, instance_domain, instance_number); + + if (benchmark_repository.file_exists(Path::new(&file_name), "test-results")) + { + continue; + } + + println!("to do: [{}, {}, {}/{}/{}]", configuration_id, instance_set_id, instance_ipc, instance_domain, instance_number); } } } diff --git a/benchmark-new/benchmark_repository/src/lib.rs b/benchmark-new/benchmark_repository/src/lib.rs index ca584a85b..f5efc6a18 100644 --- a/benchmark-new/benchmark_repository/src/lib.rs +++ b/benchmark-new/benchmark_repository/src/lib.rs @@ -283,6 +283,36 @@ impl BenchmarkRepository remote.push(&[&push_refspec], Some(&mut push_options)).expect("couldn’t push"); } + pub fn file_exists(&self, file_path: &Path, branch_name: &str) -> bool + { + let tip_reference_name = format!("refs/remotes/origin/{}", branch_name); + let tip_reference = match self.repository.find_reference(&tip_reference_name) + { + Ok(value) => value, + Err(error) => panic!("Could not find reference “{}”: {}", tip_reference_name, error), + }; + + let tree = match tip_reference.peel_to_tree() + { + Ok(value) => value, + Err(error) => panic!("Could not peel reference to tree: {}", error), + }; + + let object_id = match tree.get_path(file_path) + { + Ok(tree_entry) => tree_entry.id(), + Err(error) => return false, + }; + + let blob = match self.repository.find_blob(object_id) + { + Ok(blob) => blob, + Err(error) => return false, + }; + + true + } + pub fn read_file(&self, file_path: &Path, branch_name: &str) -> Option { let tip_reference_name = format!("refs/remotes/origin/{}", branch_name);