Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Tr/zero deletion bugfix #66

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions vibi-dpu/src/pubsub/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use std::collections::HashMap;
use std::collections::VecDeque;
use tokio::task;
use tonic::Code;
use crate::db::prs::process_and_update_pr_if_different;
use crate::core::{setup::handle_install_bitbucket, review::process_review};

#[derive(Debug, Deserialize)]
struct InstallCallback {
Expand Down Expand Up @@ -64,29 +66,6 @@ async fn process_message(attributes: &HashMap<String, String>, data_bytes: &Vec<
};
}

async fn process_install_callback(data_bytes: &[u8]) {
println!("Processing install callback message");
let msg_data_res = serde_json::from_slice::<InstallCallback>(data_bytes);
if msg_data_res.is_err() {
eprintln!("Error deserializing install callback: {:?}", msg_data_res);
return;
}
let data = msg_data_res.expect("msg_data not found");
if data.repository_provider == ProviderEnum::Github.to_string().to_lowercase() {
let code_async = data.installation_code.clone();
task::spawn(async move {
handle_install_github(&code_async).await;
println!("Processed install callback message");
});
}
if data.repository_provider == ProviderEnum::Bitbucket.to_string().to_lowercase() {
let code_async = data.installation_code.clone();
task::spawn(async move {
handle_install_bitbucket(&code_async).await;
println!("Processed install callback message");
});
}
}

pub async fn get_pubsub_client_config(keypath: &str) -> ClientConfig {
let credfile = CredentialsFile::new_from_file(keypath.to_string())
Expand Down
13 changes: 7 additions & 6 deletions vibi-dpu/src/utils/gitops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,22 @@ pub fn get_excluded_files(review: &Review) -> Option<(Vec<StatItem>, Vec<StatIte

fn process_statoutput(statstr: &str) -> Option<(Vec<StatItem>, Vec<StatItem>)>{
let statvec = process_statitems(statstr);
let mut bigfiles = Vec::<StatItem>::new();
let mut smallfiles = Vec::<StatItem>::new();
let mut excluded_files = Vec::<StatItem>::new();
let mut filtered_files = Vec::<StatItem>::new();
let line_threshold = 500;
for item in statvec {
// logic for exclusion
if (item.additions > line_threshold) ||
(item.deletions > line_threshold) ||
(item.additions + item.deletions > line_threshold) {
bigfiles.push(item);
(item.additions + item.deletions > line_threshold) ||
(item.deletions < 0) {
excluded_files.push(item);
}
else {
smallfiles.push(item);
filtered_files.push(item);
}
}
return Some((bigfiles, smallfiles));
return Some((excluded_files, filtered_files));
}

fn generate_statitem(statitems: &Vec<&str>) -> StatItem {
Expand Down