Pull params

main
Michal 2 years ago
parent cbab1b63a0
commit 21d47dd26a

@ -4,12 +4,16 @@ use std::process::Command;
use crate::info; use crate::info;
use crate::{crash, internal::AppExitCode, log}; use crate::{crash, internal::AppExitCode, log};
fn do_the_pulling( struct PullParams {
repos: Vec<String>,
verbose: bool,
smart_pull: bool, smart_pull: bool,
build_on_update: bool, build_on_update: bool,
no_regen: bool, no_regen: bool,
}
fn do_the_pulling(
repos: Vec<String>,
verbose: bool,
params: &PullParams,
) { ) {
for repo in repos { for repo in repos {
// Set root dir to return after each git pull // Set root dir to return after each git pull
@ -25,7 +29,7 @@ fn do_the_pulling(
// Pull // Pull
log!(verbose, "Pulling"); log!(verbose, "Pulling");
if smart_pull { if params.smart_pull {
// Just update the remote // Just update the remote
log!(verbose, "Smart pull"); log!(verbose, "Smart pull");
Command::new("git") Command::new("git")
@ -53,7 +57,7 @@ fn do_the_pulling(
.unwrap(); .unwrap();
// If build_on_update is set, rebuild package // If build_on_update is set, rebuild package
if build_on_update { if params.build_on_update {
info!("Package {} updated, staging for rebuild", &repo); info!("Package {} updated, staging for rebuild", &repo);
log!(verbose, "Pushing package {} to be rebuilt", &repo); log!(verbose, "Pushing package {} to be rebuilt", &repo);
packages_to_rebuild.push(repo); packages_to_rebuild.push(repo);
@ -80,11 +84,11 @@ fn do_the_pulling(
env::current_dir().unwrap() env::current_dir().unwrap()
); );
if !packages_to_rebuild.is_empty() && build_on_update { if !packages_to_rebuild.is_empty() && params.build_on_update {
info!("Rebuilding packages: {}", &packages_to_rebuild.join(", ")); info!("Rebuilding packages: {}", &packages_to_rebuild.join(", "));
log!(verbose, "Rebuilding packages: {:?}", &packages_to_rebuild); log!(verbose, "Rebuilding packages: {:?}", &packages_to_rebuild);
crate::operations::build(&packages_to_rebuild, vec![], no_regen, verbose); crate::operations::build(&packages_to_rebuild, vec![], params.no_regen, verbose);
} }
} }
} }
@ -134,8 +138,10 @@ pub fn pull(packages: Vec<String>, exclude: &[String], verbose: bool, no_regen:
do_the_pulling( do_the_pulling(
repos_applicable, repos_applicable,
verbose, verbose,
&PullParams {
smart_pull, smart_pull,
build_on_update, build_on_update,
no_regen, no_regen,
}
); );
} }

Loading…
Cancel
Save