Add function to check if files are present
This commit is contained in:
parent
9196f54c62
commit
2af028acae
@ -40,7 +40,14 @@ fn main()
|
|||||||
let instance_domain = instance["domain"].as_str().unwrap();
|
let instance_domain = instance["domain"].as_str().unwrap();
|
||||||
let instance_number = instance["instance"].as_i64().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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,6 +283,36 @@ impl BenchmarkRepository
|
|||||||
remote.push(&[&push_refspec], Some(&mut push_options)).expect("couldn’t push");
|
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<String>
|
pub fn read_file(&self, file_path: &Path, branch_name: &str) -> Option<String>
|
||||||
{
|
{
|
||||||
let tip_reference_name = format!("refs/remotes/origin/{}", branch_name);
|
let tip_reference_name = format!("refs/remotes/origin/{}", branch_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user