Commit Graph

668 Commits

Author SHA1 Message Date
aawsome
0ff0e7caa9
feat(interactive)!: Add interactive diff / overwork diff output (#1480)
Adds the possibility to compare two snapshots interactively.
From the interactive snapshots view,  press `D` to get to the diff view.
If two snapshots are marked, this diffs the two marked snapshots. If one
snapshot is marked or selected, this diffs with its parent (if there is
one).
Alternatively, you can use `rustic diff -i` to select snapshots/paths
directly.

The PR also allows to recursively compute added/removed space for dirs
and subdirs using `s` (like in #1479)

This PR is breaking as it also changes the output format of the normal
`diff` command.
2025-06-26 16:17:11 +02:00
aawsome
7cd5659383
feat(interactive): ls: Add options to compute cumulative statistics (#1479)
In the interactive `ls` view, the key `s` now recursively computes the
summary (files, size, dirs) instead of showing zero size and files for
dirs.
2025-06-15 08:40:14 +02:00
aawsome
cb97d9c5a9
feat(commands): Add missing key subcommands (#1385)
closes #983
2025-06-13 18:06:13 +02:00
aawsome
ea0917afdb
feat(commands)!: Fine-tune output for snapshots command when no grouping is given (#1375)
If no grouping is given, the json output now displays all snapshots
without artificial grouping.
Also, in this case, the group is not displayed in non-json output.

closes #1362
2025-06-12 17:07:28 +02:00
aawsome
2ec2644a93
Use rustic_core development version (#1476) 2025-06-11 22:46:38 +02:00
aawsome
cad87d8084
feat(diff): Use local PATH1 as PATH2 if no new snapshot/path is given (#1474)
closes #1472
2025-06-07 07:30:27 +02:00
aawsome
2d4e0990ee
feat(commands)!: Extend logging (#1463)
This PR extends the logging. For `backup`, `forget`, `prune` the stdout
output is now printed via an INFO log which allows to see this
information also in the log file.
Moreover, when using a log file, rustic now also logs the version and
the used command.

closes #1454
closes #1080
2025-05-21 06:03:38 +00:00
aawsome
5dab215f0f
fix: Don't allow wrong commands in front of valid ones (#1464)
closes #1436
2025-05-20 14:01:19 +00:00
Alexander Weiss
e0d94fd082 code formatting 2025-05-20 13:20:32 +02:00
Alexander Weiss
b9a4bc0cec fix clippy lints 2025-05-20 13:10:18 +02:00
aawsome
8f156d2aed
adapt to latest rustic_core (#1456)
Note: This does not **use** the latest rustic core, but makes the
necessary modifications to make it work with `rustic_core` after the
latest dependency updates.
2025-04-29 05:21:40 +02:00
aawsome
e3a032287e
use 2024 edition (#1453) 2025-04-26 09:02:10 +02:00
aawsome
2c24954932
fix: rename OPENDAL_HOT_*/COLD_* to OPENDALHOT_*/COLD_* (#1393)
#1392 was unfortunately ambiguous. IMO the better option to solve #1391
is to use OPENDALHOT_* and OPENDALCOLD_* env variables.
2025-04-19 07:21:47 +02:00
Alexander Weiss
9920c61591 fix clippy lint 2025-04-18 07:38:52 +02:00
James Tucker
173252b76e
fix(commands): remove SIGPIPE default handler (#1431)
In a complex program the cause of SIGPIPE is unclear, it may come from
socket writes, or even socket reads under some conditions, as well as on
writes to pipes. As rustic depends on third party libraries to perform
IO and handle sockets, it has little power to control the socket and
operation flags for all IO to ensure that SIGPIPE has a clear meaning.

Per a comment on #1326 the original intent was to catch a SIGPIPE from a
use case such as `command | rustic backup -` however this situation will
not create a SIGPIPE anyway, and if it did it would likely result in
incomplete data due to command exiting immediately after writing into
the pipe buffer, rather than after all pipe buffer data has been read.
The behavior of pipes in this case is to EOF after all writers have
completed and all data has been read.

The situation the other way around is different, such as `rustic backup
| command`, this would generate SIGPIPE when rustic writes to the pipe
after command has exited. This signal is however superfluous, and still
not terribly useful, as it is often more useful to handle the EPIPE that
will be returned from the write call, and gracefully cease operations,
in whatever form is required.

closes #1326
2025-03-20 06:01:41 +01:00
Léo Gaspard
47a4bb5d29
feat: push prometheus metrics to pushgateway on-demand (#1404)
Fixes #1403

---------

Co-authored-by: Alexander Weiss <alex@weissfam.de>
2025-03-04 10:33:49 +01:00
Alexander Weiss
a32d8eb52c fix clippy lints 2025-03-02 21:28:53 +01:00
aawsome
d1b11f9c5f
feat: Allow to use OPENDAL_HOT_* and OPENDAL_COLD_* env variables (#1392)
closes #1391
2025-01-02 11:34:51 +00:00
aawsome
a789b50716
fix(config): set a non-zero default progress interval for progress options (#1378) 2024-12-10 13:34:35 +00:00
aawsome
8b18e62e78
feat(commands): More dump options (#1339)
Adds output as  targz and zip.
Also adds the options `--archive` to choose the ouput format and
`--file` to directly specify a file to dump into. When a file is
specified, the ouput format is automatically chosen from the file
extension, if given.

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-12-02 23:58:43 +01:00
aawsome
f14a8bbc57
fix(commands): run backup hooks before checking source dir (#1374)
closes #1373

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-12-02 23:19:07 +01:00
simonsan
852635e25c
feat: shut down gracefully with ctrl+c (#1364)
If you have a long-running process, like `webdav` or `backup` or others,
pressing CTRL+C usually results in a non-zero exit code:

`process didn't exit successfully:
P:\CARGO\.cargo-target-win\debug\rustic.exe -P <PROFILE> webdav (exit
code: 0xc000013a, STATUS_CONTROL_C_EXIT)`

This shouldn't be the case, as it was user initiated and we can shut
down gracefully.

This PR adds this functionality, so CTRL+C shuts down `rustic`
gracefully and exits with a 0 exit-code.

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: aawsome <37850842+aawsome@users.noreply.github.com>
2024-11-30 22:09:00 +01:00
aawsome
c571279cba
feat: Add --filter-jq option (#1372)
Adds filtering using `jq` syntax. You can do something like `--filter-jq
'.summary.files_new > 51'` - works similar to what you'd expect from
`jq`.

Also puts the `rhai` and `jq` filtering into features which are enabled
by default.

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-30 22:06:19 +01:00
simonsan
d6214c4a45
test: update snapshots to include minutely configuration options
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-30 10:36:37 +01:00
simonsan
2315c0eaf6
refactor: simplify lifetime annotations in OpenFileReader and TreeIterItem implementations
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-29 16:05:11 +01:00
simonsan
2d230a44c7
refactor: clean up whitespace and update clippy linting allowances
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-29 13:31:44 +01:00
simonsan
1bdb914f16
refactor(mount): rename fields for clarity, add user options for mount (#1353)
Addresses review feedback from #973

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-25 14:21:01 +00:00
aawsome
1175ed8eac
fix(commands): Use spawn_blocking in webdav when calling rustic_core (#1365)
(after reverting #1361)

solves the webdav problem reported in #1181

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-24 09:34:50 +00:00
simonsan
984c0486e0
Revert "fix(filesystem): Use channels to communicate within webdav filesystem (#1361)"
This reverts commit d79e392b86.
2024-11-24 10:03:21 +01:00
aawsome
d79e392b86
fix(filesystem): Use channels to communicate within webdav filesystem (#1361)
Solves the webdav problem reported in #1181

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-23 16:07:33 +00:00
simonsan
e96325dbdc
Revert "feat(async): use is_async_compatible() to determine backend incompatibility and error out (#1355)"
This reverts commit c3e2557743.
2024-11-23 16:55:33 +01:00
aawsome
3d13f2e527
refactor: move webdavfs from rustic_core to rustic-rs (#1363)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-23 14:00:59 +00:00
nardoor
c3e2557743
feat(async): use is_async_compatible() to determine backend incompatibility and error out (#1355)
Use `getters` to early exit webdav when using `async_incompatible`
backends.

Using the type system or fixing all async compatibility issue is big and
structural work.
To avoid runtime crash for our users I suggest using this getter as a
temporary fix.

tracking issue: https://github.com/rustic-rs/rustic/issues/1181 (see for
more details)

> As far as I could tell, `webdav` feature was the only one spawning a
`runtime` in `rustic` and using it.

### Before merging this one:
- [x] rustic_core (core and backend) must be updated to a release that
includes rustic-rs/rustic_core#355.

---------

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-21 15:48:56 +00:00
simonsan
ae6f258dd2
chore(clippy): comment out unused lints in lib.rs
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-20 04:37:52 +01:00
simonsan
a0e91053c7
chore(clippy): apply fixes automatically
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-20 04:22:44 +01:00
simonsan
99d28fa0c3
refactor: use BTreeMap for env in global options (#1360)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: nardoor <102725206+nardoor@users.noreply.github.com>
2024-11-19 22:20:55 +01:00
simonsan
b0bd5b6e65
test: use snapshot tests for default config, show-config and completions (#1359)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-19 02:28:37 +01:00
simonsan
b8deb789eb
chore(deps): update dependencies rustic_core, rustic_backend, rustic_testing, and migrate to conflate 0.3 (#1357)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-19 00:49:00 +01:00
simonsan
5cb7d593e0
chore: fix typos
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-19 00:13:22 +01:00
aawsome
bb107be102
feat(commands): Add mount command (#973)
This PR adds the `mount` command to rustic to access snapshot contents
as a read-only filesystem when the feature-flag `mount` is chosen.

As for the `webdav` command, there are following options:
- Access to a concrete snapshot/path, e.g. `rustic mount /mnt
37a63e5b:/my/path`.
- Access to all snapshots (maybe restricted by filters) by using
templates to define a virtual directory structure where snapshots are
located. Example: `rustic mount /mnt --path-template
"[{hostname}]/[{label}]/{time}" --time-template "%Y-%m-%d_%H-%M-%S"`
(these are also defined as default). Note that for all dirs containing
only snapshots, also a `latest` entry is generated. `latest` and
identical subsequent snapshots are symlinks when using `mount`.

This PR uses fuse_mt which is not optimal as it introduces some overhead
(e.g. needs to save whole Paths in-memory).

Note: Requires https://github.com/rustic-rs/rustic_core/pull/331 to
properly show all data of files (without it builds and runs, but files
are truncated and return error when reading).

Note: Building with the `mount` feature flag requires special
dependencies and is only possible on supported platforms, see
https://github.com/cberner/fuser

closes #971

---------

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-11-10 20:49:44 +00:00
aawsome
dea0221b38
feat(commands): Add tar output to dump command (#1328)
The `dump` command will now produce a tar when called with a directory.

---------

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-24 19:05:00 +02:00
simonsan
a6a135a649
chore(deps): update tokio, ratatui, and tui-textarea (#1336)
chore(deps): update dependencies: tokio, ratatui, and tui-textarea
fix(clippy): use of deprecated method `ratatui::widgets::Table::<'a>::highlight_style`: use `Table::row_highlight_style` instead
2024-10-24 19:01:46 +02:00
simonsan
4ba226a7f3
chore(deps): update abscissa framework (#1330) 2024-10-24 18:21:05 +02:00
aawsome
d52f481be8
fix: clippy lints for new Rust version (#1329)
Fix clippy lints which came from updated Rust version. We now use `Box`
for all commands.
2024-10-20 12:37:03 +00:00
simonsan
64e1ebb5ba
chore(deps): update rustic_core (#1309)
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-09 18:43:47 +02:00
aawsome
cb3903b9dc
feat(config): Add hooks (#1218)
This PR adds `run-before`, `run-after`, `run-failure` and `run-finally`
hooks for:
- all commands in the `[global.hooks]` config profile section
- commands accessing the repository in the `[repository.hooks]` config
profile section
- the `backup` command specifically in the `[backup.hooks]` config
profile section
- specific backup sources in the `[backup.snapshots.hooks]` section

Note: This PR includes only calling the given commands. If there is the
wish for supplying information to the commands (env variables or
parameter substitution), this should be covered by a separate feature
request/PR.

closes #902

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-05 01:58:55 +00:00
aawsome
cc4f016dab
feat(config): add more filters (#1263)
Adds the following filter options:
- `filter-paths-exactly` - filters exactly the given pathlists
(supersets don't match)
- `filter-tags-exactly` - filters exactly the given taglists (supersets
don't match)
- `filter-before` - filters by time (date or date+time can be given)
- `filter-after` - filters by time (date or date+time can be given)
- `filter-size` - filters by size of snapshot'ed data (upper and lower
limit may be given)
- `filter-size-add` - filters by size added to the repository (upper and
lower limit may be given)

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-02 22:57:21 +00:00
aawsome
68cbca3ee4
perf(interactive): use update methods for refreshing snapshots (#1285)
This increases speed of refreshing a lot.
2024-10-02 21:30:54 +00:00
aawsome
2b8ee0f2e6
feat(check): Allow to only check trees+packs for given snapshots (#1230)
see #251

Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-02 18:31:18 +00:00
simonsan
238ae99450
fix(docs/cli): improve the descriptions of the CLI commands (#1277)
Fixed the capitalization of `dump` for the dump command, and then
figured, that there might be some better descriptions for other commands
as well.

---------

Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
2024-10-02 13:45:43 +00:00