mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
forget: Don't apply keep policy for given ids
This commit is contained in:
parent
ad7385616c
commit
9225fb914f
@ -101,11 +101,16 @@ pub(super) async fn execute(
|
||||
|
||||
while let Some(sn) = iter.next() {
|
||||
let (action, reason) = {
|
||||
if sn.must_delete(now) {
|
||||
if sn.must_keep(now) {
|
||||
("keep", "snapshot".to_string())
|
||||
} else if sn.must_delete(now) {
|
||||
forget_snaps.push(sn.id);
|
||||
("remove", "snapshot".to_string())
|
||||
} else if !opts.ids.is_empty() {
|
||||
forget_snaps.push(sn.id);
|
||||
("remove", "id argument".to_string())
|
||||
} else {
|
||||
match group_keep.matches(sn, last, iter.peek().is_some(), latest_time, now) {
|
||||
match group_keep.matches(sn, last, iter.peek().is_some(), latest_time) {
|
||||
None if default_keep => ("keep", "".to_string()),
|
||||
None => {
|
||||
forget_snaps.push(sn.id);
|
||||
@ -289,16 +294,10 @@ impl KeepOptions {
|
||||
last: Option<&SnapshotFile>,
|
||||
has_next: bool,
|
||||
latest_time: DateTime<Local>,
|
||||
now: DateTime<Local>,
|
||||
) -> Option<String> {
|
||||
let mut keep = false;
|
||||
let mut reason = String::new();
|
||||
|
||||
if sn.must_keep(now) {
|
||||
keep = true;
|
||||
reason.push_str("snapshot\n");
|
||||
}
|
||||
|
||||
if self
|
||||
.keep_ids
|
||||
.iter()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user