Cleanup snapshot filter options#3912
Merged
rawtaz merged 3 commits intorestic:masterfrom Sep 10, 2022
Merged
Conversation
97317c2 to
d630996
Compare
a7ad368 to
381da04
Compare
Member
Author
|
Credit for the latest description tweaks belongs to @rawtaz . |
8 tasks
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR change? What problem does it solve?
This PR cleans up the help text for the
--host,--tagand--pathoptions used to filter snapshots. It explicitly does not cleanup up the snapshot filter code itself, that has to wait until some later PR (I've started some experiments in that direction in https://github.com/MichaelEischer/restic/tree/layered-repo2).The commands
backup,catanddiffare not affected by this PR as these use a special way to resolve the snapshot (backup) or just process a single specific snapshot ID (i.e.latestis not allowed).The remaining commands be grouped into 3 categories:
FindFilteredSnapshots:copy,find,forget,snapshots,stats,tag. The filtering options apply either when no snapshots are specified or whenlatestis given.restic.FindFilteredSnapshots:mount. The filtering options are used to limit the shown snapshots.ls(FindFilteredSnapshotsbut limited to exactly a single snapshot),dump,restore(FindSnapshot/FindLatestSnapshot). The filtering options apply whenlatestis given.The previous state of the help texts is as shown below:
I've normalized this to
only consider snapshots for this 'host' (can be specified multiple times)(for the first two categories) andonly consider snapshots for this 'host', when snapshot ID \"latest\" is given (can be specified multiple times)(for the last category). The claim that the host filter only applies when no snapshot ID is given tocopy,findandtagis wrong. We could try to explain the "no snapshots"/"latest" cases though, but that would result in a rather long description.Is now
only consider snapshots which include this 'taglist' in the format 'tag[,tag,...]' (can be specified multiple times)andonly consider snapshots which include this 'taglist', when snapshot ID \"latest\" is given (can be specified multiple times). The reasoning is similar as above. Fordumpandrestorethe explanation was missing that the option can be specified multiple times.And finally
only consider snapshots which include this (absolute) 'path' (can be specified multiple times)andonly consider snapshots which include this (absolute) 'path', when snapshot ID \"latest\" is given (can be specified multiple times). Now all commands ask for an absolute path, although this is (currently) not strictly accurate, it can avoid problems. Depending on the snapshot filtering method relative paths are processed different leading to unexpected behavior. For example filtering snapshots by paths won't work between Windows and Unix-like systems. Thus, I plan to drop the handling of relative paths completely.Was the change previously discussed in an issue or on the forum?
Fixes https://forum.restic.net/t/restic-0-14-flags-syntax/5387
Checklist
[ ] There's a new file inchangelog/unreleased/that describes the changes for our users (see template).gofmton the code in all commits.