Skip to content
Open
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
8 changes: 6 additions & 2 deletions src/commands/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ impl PruneCmd {

print_stats(&prune_plan.stats);

if config.global.dry_run {
let dry_run = config.global.dry_run;
if dry_run && config.global.dry_run_warmup {
repo.warm_up(prune_plan.repack_packs().into_iter())?;
} else {
} else if !config.global.dry_run_warmup {
info!("Ignoring --dry-run-warmup works only in combination with --dry-run");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Users may not necessarily want to see this information, I'd make it a debug!

}
if !dry_run {
repo.prune(&self.opts, prune_plan)?;
}

Expand Down
8 changes: 6 additions & 2 deletions src/commands/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,19 @@ impl RestoreCmd {
info!("all file contents are fine.");
}

if dry_run {
if dry_run && config.global.dry_run_warmup {
repo.warm_up(restore_infos.to_packs().into_iter())?;
} else {
} else if !dry_run && !config.global.dry_run_warmup {
// save some memory
let repo = repo.drop_data_from_index();

let ls = repo.ls(&node, &ls_opts)?;
repo.restore(restore_infos, &self.opts, ls, &dest)?;
println!("restore done.");
} else {
info!(
"--dry-run is without warmup, --dry-run --dry-run-warmup also issues the warmup script."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. Change into debug!?

);
}

Ok(())
Expand Down
5 changes: 5 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ pub struct GlobalOptions {
#[merge(strategy=conflate::bool::overwrite_false)]
pub dry_run: bool,

/// Additional to dry run, but still issue warm-up command if configured
#[clap(long, global = true, env = "RUSTIC_DRY_RUN_WARMUP")]
#[merge(strategy=conflate::bool::overwrite_false)]
pub dry_run_warmup: bool,

/// Check if index matches pack files and read pack headers if necessary
#[clap(long, global = true, env = "RUSTIC_CHECK_INDEX")]
#[merge(strategy=conflate::bool::overwrite_false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ expression: config
[global]
use-profiles = []
dry-run = false
dry-run-warmup = false
check-index = false
no-progress = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RusticConfig {
use_profiles: [],
group_by: None,
dry_run: false,
dry_run_warmup: false,
check_index: false,
log_level: None,
log_file: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ expression: deserialized
[global]
use-profiles = []
dry-run = false
dry-run-warmup = false
check-index = false
no-progress = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RusticConfig {
use_profiles: [],
group_by: None,
dry_run: false,
dry_run_warmup: false,
check_index: false,
log_level: None,
log_file: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ expression: serialized
[global]
use-profiles = []
dry-run = false
dry-run-warmup = false
check-index = false
no-progress = false

Expand Down
3 changes: 3 additions & 0 deletions tests/snapshots/show_config__show_config_passes.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ expression: output
[global]
use-profiles = []
dry-run = false
dry-run-warmup = false
check-index = false
no-progress = false

Expand All @@ -19,6 +20,8 @@ run-finally = []
[global.metrics-labels]

[repository]
repository = "/tmp/repo"
password = "test"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those come from a local rustic.toml when you run the tests. In the CI, there is no rustic.toml. Can you remove these two changes?

no-cache = false
warm-up = false

Expand Down