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

backup: add --dry-run/-n flag to show what would happen. #2308

Open
wants to merge 1 commit into
base: master
from

Conversation

@rmmh
Copy link

commented Jun 13, 2019

What is the purpose of this change? What does it change?

Implement backup --dry-run (#1542)

This can be used to check how large a backup is or validate exclusions.
It does not actually write any data to the underlying backend. This is
implemented as a simple overlay backend that accepts writes without
forwarding them, passes through reads, and generally does the minimal
necessary to pretend that progress is actually happening.

Example usage:

$ restic -r /srv/restic-repo backup ~/work --dry-run -vv | grep added
modified  /plan.txt, saved in 0.000s (9.110 KiB added)
modified  /archive.tar.gz, saved in 0.140s (25.542 MiB added)
Would be added to the repo: 25.551 MiB

Was the change discussed in an issue or in the forum before?

Yes, #1542

Checklist

  • I have read the Contribution Guidelines
  • I have added tests for all changes in this PR
  • I have added documentation for the changes (in the manual)
  • There's a new file in changelog/unreleased/ that describes the changes for our users (template here)
  • I have run gofmt on the code in all commits
  • All commit messages are formatted in the same style as the other commits in the repo
  • I'm done, this Pull Request is ready for review

@rmmh rmmh force-pushed the rmmh:backup-dry branch from f3fa419 to 455bda2 Jun 13, 2019

backup: add --dry-run/-n flag to show what would happen.
This can be used to check how large a backup is or validate exclusions.
It does not actually write any data to the underlying backend. This is
implemented as a simple overlay backend that accepts writes without
forwarding them, passes through reads, and generally does the minimal
necessary to pretend that progress is actually happening.

Fixes #1542

Example usage:

$ restic -vv --dry-run . | grep added
new       /changelog/unreleased/issue-1542, saved in 0.000s (350 B added)
modified  /cmd/restic/cmd_backup.go, saved in 0.000s (16.543 KiB added)
modified  /cmd/restic/global.go, saved in 0.000s (0 B added)
new       /internal/backend/dry/dry_backend_test.go, saved in 0.000s (3.866 KiB added)
new       /internal/backend/dry/dry_backend.go, saved in 0.000s (3.744 KiB added)
modified  /internal/backend/test/tests.go, saved in 0.000s (0 B added)
modified  /internal/repository/repository.go, saved in 0.000s (20.707 KiB added)
modified  /internal/ui/backup.go, saved in 0.000s (9.110 KiB added)
modified  /internal/ui/jsonstatus/status.go, saved in 0.001s (11.055 KiB added)
modified  /restic, saved in 0.131s (25.542 MiB added)
Would be added to the repo: 25.892 MiB

@rmmh rmmh force-pushed the rmmh:backup-dry branch from 455bda2 to 7ee36d3 Jun 13, 2019

@rmmh rmmh closed this Jun 13, 2019

@rmmh rmmh reopened this Jun 13, 2019

@codecov-io

This comment has been minimized.

Copy link

commented Jun 13, 2019

Codecov Report

Merging #2308 into master will decrease coverage by 3.87%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2308      +/-   ##
==========================================
- Coverage   51.09%   47.22%   -3.88%     
==========================================
  Files         178      179       +1     
  Lines       14546    14640      +94     
==========================================
- Hits         7433     6914     -519     
- Misses       6042     6700     +658     
+ Partials     1071     1026      -45
Impacted Files Coverage Δ
internal/ui/backup.go 0% <0%> (ø) ⬆️
internal/repository/repository.go 55.96% <0%> (-0.28%) ⬇️
cmd/restic/cmd_backup.go 45.7% <100%> (+0.84%) ⬆️
internal/backend/dry/dry_backend.go 80.48% <80.48%> (ø)
internal/backend/b2/b2.go 0% <0%> (-80.69%) ⬇️
internal/backend/swift/swift.go 0% <0%> (-78.83%) ⬇️
internal/backend/gs/gs.go 0% <0%> (-74%) ⬇️
internal/backend/azure/azure.go 0% <0%> (-69.46%) ⬇️
internal/backend/swift/config.go 34.69% <0%> (-57.15%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bd5db4...7ee36d3. Read the comment docs.

@HaleTom

This comment has been minimized.

Copy link

commented Aug 10, 2019

I would love to see this merged to check my excludes are being applied correctly.

What is the next step?

@HaleTom
Copy link

left a comment

Would you please consider adding a ignored to go along with new and modified?

Forum thread

@rmmh

This comment has been minimized.

Copy link
Author

commented Aug 10, 2019

This isn't implemented in a way where it even sees ignored files-- that sort of change would be better for a different PR that works on the filtering system. Maybe some custom verbose level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.