mirror of
https://github.com/kopia/kopia.git
synced 2026-01-24 14:28:06 -05:00
* feat(cli): implementation for 'kopia snapshot fix' This allows modifications and fixes to the snapshots after they have been taken. Supported are: * `kopia snapshot fix remove-invalid-files [--verify-files-percent=X]` Removes all directory entries where the underlying files cannot be read based on index analysis (this does not read the files, only index structures so is reasonably quick). `--verify-files-percent=100` can be used to trigger full read for all files. * `kopia snapshot fix remove-files --object-id=<object-id>` Removes the object with a given ID from the entire snapshot tree. Useful when you accidentally snapshot a sensitive file. * `kopia snapshot fix remove-files --filename=<wildcard>` Removes the files with a given name from the entire snapshot tree. Useful when you accidentally snapshot a sensitive file. By default all snapshots are analyzed and rewritten. To limit the scope use: --source=user@host:/path --manifest-id=manifestID By default the rewrite operation writes new directory entries but does not replace the manifests. To do that pass `--commit`. Related #1906 Fixes #799 reorganized CLI per PR suggestion * additional logging for diff command * added Clone() method to snapshot manifst and directory entry * added a comprehensive test, moved DirRewriter to separate file * pr feedback * more pr feedback * improved logging output * disable test in -race configuration since it's way to slow * pr feedback
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package cli
|
|
|
|
type commandSnapshot struct {
|
|
copyHistory commandSnapshotCopyMoveHistory
|
|
moveHistory commandSnapshotCopyMoveHistory
|
|
create commandSnapshotCreate
|
|
delete commandSnapshotDelete
|
|
estimate commandSnapshotEstimate
|
|
expire commandSnapshotExpire
|
|
fix commandSnapshotFix
|
|
gc commandSnapshotGC
|
|
list commandSnapshotList
|
|
migrate commandSnapshotMigrate
|
|
pin commandSnapshotPin
|
|
restore commandSnapshotRestore
|
|
verify commandSnapshotVerify
|
|
}
|
|
|
|
func (c *commandSnapshot) setup(svc advancedAppServices, parent commandParent) {
|
|
cmd := parent.Command("snapshot", "Commands to manipulate snapshots.").Alias("snap")
|
|
c.copyHistory.setup(svc, cmd, false)
|
|
c.moveHistory.setup(svc, cmd, true)
|
|
c.create.setup(svc, cmd)
|
|
c.delete.setup(svc, cmd)
|
|
c.estimate.setup(svc, cmd)
|
|
c.expire.setup(svc, cmd)
|
|
c.fix.setup(svc, cmd)
|
|
c.gc.setup(svc, cmd)
|
|
c.list.setup(svc, cmd)
|
|
c.migrate.setup(svc, cmd)
|
|
c.pin.setup(svc, cmd)
|
|
c.restore.setup(svc, cmd)
|
|
c.verify.setup(svc, cmd)
|
|
}
|