Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diff: show statistic #440

Closed
aawsome opened this issue Feb 22, 2023 · 0 comments · Fixed by #1178
Closed

diff: show statistic #440

aawsome opened this issue Feb 22, 2023 · 0 comments · Fixed by #1178
Labels
A-commands Area: Related to commands in `rustic` C-enhancement Category: New feature or request E-help-wanted Call for participation: Help is requested to fix this issue good first issue Call for participation: Good for newcomers

Comments

@aawsome
Copy link
Member

aawsome commented Feb 22, 2023

The diff command currently shows differences between two snapshots or a snapshot and a local path. Having a statistic similar to restic would be nice. I.e. something like:

    Files:           0 new,     0 removed,     2 changed
    Dirs:            1 new,     0 removed                                   
    Others:          0 new,     0 removed                             
    Data Blobs:     14 new,    15 removed                        
    Tree Blobs:      2 new,     1 removed
      Added:   16.403 MiB
      Removed: 16.402 MiB
@aawsome aawsome added C-enhancement Category: New feature or request good first issue Call for participation: Good for newcomers E-help-wanted Call for participation: Help is requested to fix this issue labels Feb 22, 2023
@simonsan simonsan added the A-commands Area: Related to commands in `rustic` label Jul 16, 2023
@simonsan simonsan changed the title diff: show statistic diff: show statistic Jul 16, 2023
nardoor added a commit to nardoor/rustic that referenced this issue Jul 13, 2024
nardoor added a commit to nardoor/rustic that referenced this issue Aug 5, 2024
github-merge-queue bot pushed a commit that referenced this issue Aug 10, 2024
closes #440

### Description

The proposed code contains:
- a DiffStatistics structure used to hold count of stats
- this structure offers a few helping functions that will look at a
given NodeType to increment the associated counter
- it has a Display implementation used to display the statistics in
STDOUT
- this structure is used in the `diff` function

### Exemple

```bash
rustic --log-level debug -r test-repo --password password diff 8e57051d:config ./config
[INFO] using no config file, none of these exist: /home/nardor/.config/rustic/rustic.toml, /etc/rustic/rustic.toml, ./rustic.toml
[INFO] repository local:test-repo: password is correct.
[INFO] using cache at /home/nardor/.cache/rustic/3797e1fe324e97ac068e303e672da3d34af09cd73888bcfd09538cd72692bf7d
[00:00:00] reading index...               ████████████████████████████████████████          2/2                               
[00:00:00] getting snapshot...            ████████████████████████████████████████          0                                
[INFO] getting snapshot...
[00:00:00] getting snapshot...            ████████████████████████████████████████          0                                 
-    "README.md"
M    "bar"
+    "new_dir"
+    "new_dir/new_file"
-    "services"
-    "services/b2.toml"
-    "services/rclone_ovh-hot-cold.toml"
-    "services/s3_aws.toml"
-    "services/s3_idrive.toml"
-    "services/sftp.toml"
-    "services/sftp_hetzner_sbox.toml"
-    "services/webdav_owncloud_nextcloud.toml"
Files:	1 new,	8 removed, 	1 changed
Dirs:	1 new,	1 removed
Others:	0 new,	0 removed
```

### Testing

I am not sure what tests I can add.
Please let me know if you think of any test about this.

Thanks in advance for any feedback.

---------

Co-authored-by: Alexander Weiss <alex@weissfam.de>
Co-authored-by: aawsome <37850842+aawsome@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-commands Area: Related to commands in `rustic` C-enhancement Category: New feature or request E-help-wanted Call for participation: Help is requested to fix this issue good first issue Call for participation: Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants