Skip to content

Commit

Permalink
Merge branch 'main' into snapshot-no-group
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsan authored Dec 3, 2024
2 parents 616e4fa + f565eea commit c4c3902
Show file tree
Hide file tree
Showing 9 changed files with 407 additions and 60 deletions.
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,49 @@

All notable changes to this project will be documented in this file.

## [0.9.5](https://github.com/rustic-rs/rustic/compare/v0.9.4...v0.9.5) - 2024-12-02

### Added

- *(commands)* More dump options ([#1339](https://github.com/rustic-rs/rustic/pull/1339))
- shut down gracefully with ctrl+c ([#1364](https://github.com/rustic-rs/rustic/pull/1364))
- Add --filter-jq option ([#1372](https://github.com/rustic-rs/rustic/pull/1372))
- *(commands)* Add `mount` command ([#973](https://github.com/rustic-rs/rustic/pull/973))
- Error messages are now much improve
([rustic_core](https://github.com/rustic-rs/rustic_core/releases/tag/rustic_core-v0.6.0))

### Fixed

- *(commands)* run backup hooks before checking source dir ([#1374](https://github.com/rustic-rs/rustic/pull/1374))
- *(commands)* Use spawn_blocking in webdav when calling rustic_core ([#1365](https://github.com/rustic-rs/rustic/pull/1365))
- *(forget)* Add minutely timeline
([rustic_core](https://github.com/rustic-rs/rustic_core/releases/tag/rustic_core-v0.7.2))
- *(init)* Prevent overwriting hot repository
([rustic_core](https://github.com/rustic-rs/rustic_core/releases/tag/rustic_core-v0.6.0))

### Other

- update snapshots to include minutely configuration options
- *(deps)* update rustic_core, bytes, and libc dependencies to latest versions
- simplify lifetime annotations in OpenFileReader and TreeIterItem implementations
- clean up whitespace and update clippy linting allowances
- *(deps)* update dependencies to latest versions
- *(deps)* update lockfile to get rid of vulnerable `url` version
- *(mount)* rename fields for clarity, add user options for mount ([#1353](https://github.com/rustic-rs/rustic/pull/1353))
- *(deps)* update dependencies
- *(deps)* don't use rustic_core webdav feature ([#1367](https://github.com/rustic-rs/rustic/pull/1367))
- move `webdavfs` from `rustic_core` to `rustic-rs` ([#1363](https://github.com/rustic-rs/rustic/pull/1363))
- *(clippy)* comment out unused lints in lib.rs
- *(clippy)* apply fixes automatically
- use BTreeMap for env in global options ([#1360](https://github.com/rustic-rs/rustic/pull/1360))
- add tiny framework for testing rustic's compat with latest restic ([#1303](https://github.com/rustic-rs/rustic/pull/1303))
- use snapshot tests for default config, show-config and completions ([#1359](https://github.com/rustic-rs/rustic/pull/1359))
- *(deps)* update dependencies rustic_core, rustic_backend, rustic_testing, and migrate to conflate 0.3 ([#1357](https://github.com/rustic-rs/rustic/pull/1357))
- fix typos
- *(build)* add platform-dependent settings and remove ci flag for extra features
- clarify `--use-profile` command in config by using long form ([#1344](https://github.com/rustic-rs/rustic/pull/1344))
- *(deps)* update core and testing crates ([#1340](https://github.com/rustic-rs/rustic/pull/1340))

## [0.9.4](https://github.com/rustic-rs/rustic/compare/v0.9.3...v0.9.4) - 2024-10-24

### Added
Expand Down
78 changes: 77 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustic-rs"
version = "0.9.4"
version = "0.9.5"
authors = ["the rustic-rs team"]
categories = ["command-line-utilities"]
documentation = "https://docs.rs/rustic-rs"
Expand Down Expand Up @@ -103,10 +103,12 @@ clap = { version = "4", features = ["derive", "env", "wrap_help"] }
clap_complete = "4"
conflate = "0.3.3"
convert_case = "0.6.0"
ctrlc = { version = "3.4.5", features = ["termination"] }
dateparser = "0.2.1"
derive_more = { version = "1", features = ["debug"] }
dialoguer = "0.11.0"
directories = "5"
flate2 = "1.0.34"
fuse_mt = { version = "0.6", optional = true }
futures = { version = "0.3.31", optional = true }
gethostname = "0.5"
Expand All @@ -119,6 +121,7 @@ open = "5.3.1"
self_update = { version = "=0.39.0", default-features = false, optional = true, features = ["rustls", "archive-tar", "compression-flate2"] } # FIXME: Downgraded to 0.39.0 due to https://github.com/jaemk/self_update/issues/136
tar = "0.4.43"
toml = "0.8"
zip = { version = "2.2.0", default-features = false, features = ["deflate", "chrono"] }

# filtering
jaq-core = { version = "2", optional = true }
Expand Down
1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ allow = [
"CC0-1.0",
"Zlib",
"Unicode-3.0",
"BSL-1.0",
]
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
Expand Down
17 changes: 16 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use std::fmt::Debug;
use std::fs::File;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::mpsc::channel;

#[cfg(feature = "mount")]
use crate::commands::mount::MountCmd;
Expand Down Expand Up @@ -64,7 +65,7 @@ use clap::builder::{
};
use convert_case::{Case, Casing};
use human_panic::setup_panic;
use log::{log, Level};
use log::{info, log, Level};
use simplelog::{CombinedLogger, LevelFilter, TermLogger, TerminalMode, WriteLogger};

use self::find::FindCmd;
Expand Down Expand Up @@ -179,6 +180,20 @@ impl Runnable for EntryPoint {
// Set up panic hook for better error messages and logs
setup_panic!();

// Set up Ctrl-C handler
let (tx, rx) = channel();

ctrlc::set_handler(move || tx.send(()).expect("Could not send signal on channel."))
.expect("Error setting Ctrl-C handler");

_ = std::thread::spawn(move || {
// Wait for Ctrl-C
rx.recv().expect("Could not receive from channel.");
info!("Ctrl-C received, shutting down...");
RUSTIC_APP.shutdown(Shutdown::Graceful)
});

// Run the subcommand
self.commands.run();
RUSTIC_APP.shutdown(Shutdown::Graceful)
}
Expand Down
76 changes: 38 additions & 38 deletions src/commands/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,47 +184,47 @@ impl BackupCmd {
}
.to_indexed_ids()?;

let config_snapshot_sources: Vec<_> = snapshot_opts
.iter()
.map(|opt| -> Result<_> {
Ok(PathList::from_iter(&opt.sources)
.sanitize()
.with_context(|| {
format!(
"error sanitizing sources=\"{:?}\" in config file",
opt.sources
)
})?
.merge())
})
.filter_map(|p| match p {
Ok(paths) => Some(paths),
Err(err) => {
warn!("{err}");
None
let hooks = config.backup.hooks.with_context("backup");
hooks.use_with(|| -> Result<_> {
let config_snapshot_sources: Vec<_> = snapshot_opts
.iter()
.map(|opt| -> Result<_> {
Ok(PathList::from_iter(&opt.sources)
.sanitize()
.with_context(|| {
format!(
"error sanitizing sources=\"{:?}\" in config file",
opt.sources
)
})?
.merge())
})
.filter_map(|p| match p {
Ok(paths) => Some(paths),
Err(err) => {
warn!("{err}");
None
}
})
.collect();

let snapshot_sources = match (self.cli_sources.is_empty(), snapshot_opts.is_empty()) {
(false, _) => {
let item = PathList::from_iter(&self.cli_sources).sanitize()?;
vec![item]
}
})
.collect();

let snapshot_sources = match (self.cli_sources.is_empty(), snapshot_opts.is_empty()) {
(false, _) => {
let item = PathList::from_iter(&self.cli_sources).sanitize()?;
vec![item]
}
(true, false) => {
info!("using all backup sources from config file.");
config_snapshot_sources.clone()
}
(true, true) => {
bail!("no backup source given.");
(true, false) => {
info!("using all backup sources from config file.");
config_snapshot_sources.clone()
}
(true, true) => {
bail!("no backup source given.");
}
};
if snapshot_sources.is_empty() {
return Ok(());
}
};
if snapshot_sources.is_empty() {
return Ok(());
}

let hooks = config.backup.hooks.with_context("backup");
hooks.use_with(|| -> Result<_> {
let mut is_err = false;
for sources in snapshot_sources {
let mut opts = self.clone();
Expand Down
Loading

0 comments on commit c4c3902

Please sign in to comment.