Sébastien Gross
2a92b68e65
cmd/snapshots: Add option to limit snapshots list
...
This patch adds a `--latest` option to limit snapshots list to the n
last snapshots. It is very similar to the `--last` one but does not
limit to one entry. It also deprecates the `--last` flag usage in
favor of `--latest 1`
Output example:
$ restic snapshots --latest 2
repository 0d3eb989 opened successfully, password is correct
ID Time Host Tags Paths
------------------------------------------------------------
5a33bdcc 2020-12-14 12:30:00 local /home
73887d8e 2020-12-15 12:30:00 local /home
------------------------------------------------------------
2 snapshots
Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
2021-05-13 20:18:23 +02:00
Michael Eischer
5e6af77b7a
Unify interactive terminal detection code
...
Previously the progress bar / status update interval used
stdoutIsTerminal to determine whether it is possible to update the
progress bar or not. However, its implementation differed from the
detection within the backup command which included additional checks to
detect the presence of mintty on Windows. mintty behaves like a terminal
but uses pipes for communication.
This adds stdoutCanUpdateStatus() which calls the same terminal detection
code used by backup. This ensures that all commands consistently switch
between interactive and non-interactive terminal mode.
stdoutIsTerminal() now also returns true whenever stdoutCanUpdateStatus()
does so. This is required to properly handle the special case of mintty.
2021-04-11 20:02:09 +02:00
MichaelEischer
efb10b3c40
Merge pull request #3347 from jazcap53/fix_ambiguous_warning
...
Change ambiguous Warning message
2021-03-27 12:54:07 +01:00
Andrew Jarcho
9f44129c2f
Change ambiguous Warning message
...
Fixes #3346
On branch fix_ambiguous_warning
Changes to be committed:
modified: cmd_backup.go
2021-03-24 10:44:47 -04:00
Hendrik Luup
5592c17e4a
Display 'created new cache in ' message only if output is terminal
2021-03-22 11:31:08 +02:00
Michael Eischer
54d58edacc
debug: fix usage for examine command
2021-03-10 22:22:33 +01:00
Michael Eischer
5975ed61f3
debug: fix linter warning
2021-03-10 21:22:53 +01:00
Michael Eischer
dc62ec5933
debug: use Printf/Warnf for output
2021-03-10 21:20:21 +01:00
Michael Eischer
547d9b384d
debug: cleanup repair code
2021-03-10 21:15:38 +01:00
Michael Eischer
fa7b9d5dfe
debug: Cleanup pack size checks
2021-03-10 20:57:14 +01:00
Michael Eischer
6774fc6454
debug: check arguments and cleanup error handling
2021-03-10 20:43:22 +01:00
Michael Eischer
096f15db5c
debug: extract examinePack function
2021-03-10 20:21:05 +01:00
Michael Eischer
84491ff40b
debug: store repaired and correct blobs
2021-03-10 20:03:44 +01:00
Alexander Neumann
b3c3121622
debug: Save raw decrypt (disregarding signature)
2021-03-10 20:03:44 +01:00
Alexander Neumann
ce4b6d0874
examine: add byte repair mode
2021-03-10 20:03:44 +01:00
Alexander Neumann
52061e817c
debug: fix percentage
2021-03-10 20:03:44 +01:00
Alexander Neumann
133ac42a0b
debug: check file content hash
2021-03-10 20:03:44 +01:00
Alexander Neumann
90f975fa1c
debug: make output less verbose
2021-03-10 20:03:44 +01:00
Alexander Neumann
086993bae1
debug: check packs not in index, implement repair
2021-03-10 20:03:44 +01:00
Alexander Neumann
d6f78163d4
Add 'debug examine' command to debug #1999
2021-03-10 20:03:44 +01:00
MichaelEischer
c9b4fadd91
Merge pull request #3294 from Achilleshiel/fix-copy-repofile
...
Add RepositoryFile2 Option for secondary repository
2021-03-08 22:50:31 +01:00
Michael Eischer
da458a55db
Cleanup comments in secondary repo test
2021-03-08 22:41:13 +01:00
Wouter Horlings
9ccdba9df6
Add repositoryFile2 option
...
The `init` and `copy` commands can now use `--repository-file2` flag and
the `$RESTIC_REPOSITORY_FILE2` environment variable.
This also fixes the conflict with the `--repository-file` and `--repo2`
flag.
Tests are added for the initSecondaryGlobalOpts function.
This adds a NOK function to the test helper functions. This NOK tests if
err is not nil, and otherwise fail the test.
With the NOK function a couple of sad paths are tested in the
initSecondaryGlobalOpts function.
In total the tests checks wether the following are passed correct:
- Password
- PasswordFile
- Repo
- RepositoryFile
The following situation must return an error to pass the test:
- no Repo or RepositoryFile defined
- Repo and RepositoryFile defined both
2021-03-08 22:41:13 +01:00
Michael Eischer
427781928f
copy: test that trees with unstable json encoding are properly copied
2021-03-08 22:16:48 +01:00
Michael Eischer
2fc7abac35
copy: copy raw bytes of tree blobs
...
This avoids problems when for some reason the JSON encoding changes.
This also ensures forward compatibility with future restic versions
which might e.g. add new fields to the tree metadata.
2021-03-08 22:16:48 +01:00
Juergen Hoetzel
18fccb5995
backup: In case of error also Wait() for terminal goroutine
...
This prevents a race condition where the final summary message can get lost.
2021-03-08 22:11:34 +01:00
MichaelEischer
814a399e4c
Merge pull request #3283 from dennypage/master
...
Treat an empty password as a fatal error for repository init.
2021-02-28 00:49:21 +01:00
Denny Page
0f41e99ea7
Treat an empty password as a fatal error for repository init.
2021-02-28 00:40:00 +01:00
Michael Eischer
9e852af5be
check: Fix crash of --read-data-subset=x% on empty repository
...
Rounding up to at least one pack file should only be done if at least a
pack file exists.
2021-02-27 16:05:36 +01:00
Michael Eischer
65bd2a9a49
backup: Correctly handle --quiet flag
...
The quiet flag changes the backup output to assume a non-interactive
terminal. However, the output progress interval was not set to 0 by
default.
2021-02-15 22:14:58 +01:00
Alexander Neumann
bb53fcfc0d
Set development version for 0.12.0
2021-02-14 11:44:24 +01:00
Alexander Neumann
27f241334e
Add version for 0.12.0
2021-02-14 11:44:20 +01:00
Alexander Neumann
c0f2c1d871
ls: Check for non-nil error before calling panic()
2021-02-07 21:12:54 +01:00
Alexander Weiss
39a26066f7
rebuild-index: add missing bar.Done()
2021-01-31 18:28:02 +01:00
MichaelEischer
b3dc127af5
Merge pull request #3207 from aawsome/filerestorer-fix-errorhandling
...
Fix error handling in filerestorer and fix #3166
2021-01-31 17:47:46 +01:00
Alexander Weiss
6e942693ba
Fix #3166
2021-01-31 14:22:57 +01:00
Alexander Neumann
027a51529d
prune: Improve error message for missing files
...
This commit changes the error message so that a list of file names is
printed. Before, just the raw map was printed, which is not a great user
interface.
2021-01-31 11:31:27 +01:00
Alexander Neumann
f867e65bcd
Fix issues reported by staticcheck
2021-01-30 20:43:53 +01:00
Alexander Neumann
aef3658a5f
Address review comments
2021-01-30 20:02:37 +01:00
Alexander Neumann
200f09522d
Add more error checks
2021-01-30 20:02:37 +01:00
Alexander Neumann
cbd88c457a
backup: Improve error handling
2021-01-30 20:02:37 +01:00
Alexander Neumann
1a0eb05bfa
errcheck: Add more error checks
2021-01-30 20:02:37 +01:00
MichaelEischer
4d576c2f79
Merge pull request #3217 from M4a1x/read-data-subset-fix
...
Fix missing rand seed for restic check --read-data-subset=x%
2021-01-29 23:34:13 +01:00
Max Stabel
f9e1fa26ff
Fix missing rand seed for restic check --read-data-subset=x%
2021-01-29 23:18:35 +01:00
Alexander Weiss
e08e65dc30
prune: Simplify logic selecting packs to repack
2021-01-29 22:27:22 +01:00
Alexander Weiss
daeb4cdf8f
prune: Fix statistics for --repack-cacheable-only
2021-01-29 22:27:22 +01:00
Alexander Neumann
a16ce65295
Merge pull request #3244 from MichaelEischer/better-damage-reports
...
Print more details about possible repository damages
2021-01-29 11:45:45 +01:00
rawtaz
de7e3a0648
Merge pull request #2823 from greatroar/trust-mtime
...
Add --ignore-ctime flag to backup and document change detection
2021-01-29 00:02:19 +01:00
greatroar
6bd8a2faaa
backup: Add --ignore-ctime option and document change detection
2021-01-28 23:42:10 +01:00
Michael Eischer
58b5679f14
prune: reword missing blobs error
...
The previous wording could be understood such that the prune run did
damage the repository.
2021-01-28 21:48:24 +01:00
Michael Eischer
7b8886c052
prune: report missing but unneeded pack files
...
This indicates a damaged repository so add some output to help with
debugging.
2021-01-28 21:46:01 +01:00
Michael Eischer
ff95999246
rebuild-index: report added/removed/reindexed files
...
This should help with investigating missing pack files.
2021-01-28 21:46:01 +01:00
Michael Eischer
b71c52797a
find: correctly expand multiple blob ids
...
For example `restic find --show-pack-id --blob f78dc991 5b9e4366 ddd8c7d4`
would previously only expand one blob if all of them belong to the same
file.
2021-01-28 21:21:54 +01:00
MichaelEischer
82140967d3
Merge pull request #3228 from aawsome/prune-all-trees
...
prune: Remove all unused trees
2021-01-28 21:04:27 +01:00
MichaelEischer
35033d9b79
Merge pull request #3177 from MichaelEischer/fix-2759
...
prune: don't print stacktrace on console
2021-01-28 20:28:45 +01:00
Alexander Neumann
4d40c70214
Merge pull request #3211 from MichaelEischer/sftp-speedup
...
Speed-up caching/pack download via SFTP
2021-01-28 14:16:55 +01:00
Alexander Neumann
44169d0dc4
Merge pull request #3205 from MichaelEischer/fix-quiet-verbose
...
Properly check that --quiet and --verbose are not combined
2021-01-28 13:53:31 +01:00
Alexander Neumann
bdfedf1f5b
Merge pull request #3173 from MichaelEischer/unify-index-loading
...
Unify index loading
2021-01-28 13:50:42 +01:00
Michael Eischer
e2b0072441
check: add progress bar to the tree structure check
2021-01-28 11:10:50 +01:00
Michael Eischer
505f8a2229
progress/counter: Support updating the progress bar maximum
2021-01-28 11:10:47 +01:00
Michael Eischer
eda8c67616
restic: let FindUsedBlobs handle multiple snapshots at once
2021-01-28 11:08:43 +01:00
Michael Eischer
258ce0c1e5
parallel: report progress for StreamTrees
...
This assigns an id to each tree root and then keeps track of how many
tree loads (i.e. trees referenced for the first time) are pending per
tree root. Once a tree root and its subtrees were fully processed there
are no more pending tree loads and the tree root is reported as
processed.
2021-01-28 11:08:43 +01:00
Michael Eischer
3d6a3e2555
copy: Remove treeCloner struct
2021-01-28 11:08:43 +01:00
Michael Eischer
0caad1e890
copy: parallelize tree walk
2021-01-28 11:08:43 +01:00
Alexander Neumann
a4689eb3b9
Merge pull request #3199 from MichaelEischer/non-interactive-counter
...
Don't print progress on non-interactive terminals
2021-01-28 10:53:38 +01:00
Alexander Weiss
d7dc19a496
prune: Always repack packs containing tree blobs
2021-01-15 16:42:04 +01:00
Michael Eischer
f3442ce8a5
Test that WriteTo of a backend's Load remains accessible
2021-01-03 22:23:53 +01:00
Michael Eischer
97388b3504
Properly check that --quiet and --verbose are not combined
...
If --verbose is specified once, then globalOptions.Verbose == 1.
Previously --quiet --verbose would silently ignore the --verbose flag.
2020-12-30 21:24:18 +01:00
MichaelEischer
e1efc193e1
Merge pull request #3139 from aawsome/prune-healing
...
prune: Add healing of repository in some situations
2020-12-29 22:17:27 +01:00
Alexander Weiss
f0113139ea
prune: Correct error message
2020-12-29 20:20:05 +01:00
Alexander Weiss
f6df94a50e
prune: Add self-healing
...
Allow prune to heal situations where blobs in the index are missing or
the corresponding packfiles are damaged if those blobs are not needed.
2020-12-29 20:20:05 +01:00
MichaelEischer
31e56f1ad5
Merge pull request #3197 from SkYNewZ/fix/3183
...
Fix tag handling for multiple tag lists
2020-12-29 18:44:38 +01:00
greatroar
dec5008369
Warn when unlock fails instead of returning an error
...
Only one caller was checking the error.
2020-12-29 17:48:20 +01:00
Quentin Lemaire
25ecf9eafb
fix(cmd_tag): Use restic.TagLists
2020-12-29 17:12:46 +01:00
Quentin Lemaire
e88f3fb80c
fix(cmd_backup): Use restic.TagLists
2020-12-29 17:12:46 +01:00
Michael Eischer
05a987b07c
Support values less than 1 for RESTIC_PROGRESS_FPS
...
For example set the variable to 0.016666 to print the progress once per
minute.
2020-12-29 16:32:18 +01:00
Michael Eischer
85fe5feadb
Unify progress report frequency calculation
2020-12-29 16:03:43 +01:00
Michael Eischer
969141b5e9
Honor RESTIC_PROGRESS_FPS env variable on non-interactive terminals
...
This makes it possible to use the environment variable to also get
regular progress updates on non-interactive terminals.
2020-12-29 16:03:43 +01:00
Michael Eischer
c2ef049f1b
ui/progress: don't print progress on non-interactive terminals
...
This reverts to the old behavior of not printing progress updates on
non-interactive terminals. It was accidentally changed in #3058 .
2020-12-29 16:03:43 +01:00
greatroar
18531e3d6f
Portability fixes to internal/restic
...
syscall.Mknod is not available on AIX.
2020-12-29 01:35:01 +01:00
DRON-666
332b1896d1
Some options
fixes
...
Add tests for bool type.
Fix subtle bug in TestOptionsApplyInvalid.
Fix options list formatting.
2020-12-23 23:26:04 +03:00
Alexander Weiss
d8d2cc6dd9
Simplify rebuild-index code
2020-12-22 23:01:58 +01:00
Alexander Weiss
68b74e359e
Count packs directly in RebuildIndexFiles
2020-12-22 23:01:58 +01:00
Michael Eischer
ccc84af73d
debug/list: parallelize index loading
2020-12-22 22:36:18 +01:00
Alexander Neumann
edf89e1c74
forget: Enable --dry-run together with --prune
2020-12-22 20:58:02 +01:00
Michael Eischer
cfea79d0c5
prune: don't print stacktrace on console
2020-12-19 14:28:48 +01:00
DRON-666
2ca76afc2b
dump: Add new option --archive
2020-12-19 01:09:47 +03:00
DRON-666
0256f95994
dump: Split tar and walk logic
2020-12-19 01:09:47 +03:00
Alexander Neumann
0d5b764f90
Merge pull request #3130 from aawsome/snapshots-parallel
...
Make loading snapshots parallel
2020-12-06 21:08:18 +01:00
Alexander Weiss
e329623771
Remove LoadAllSnapshots
2020-12-06 05:22:27 +01:00
Alexander Weiss
5b9ee56335
Add ForAllSnapshots
2020-12-06 05:04:21 +01:00
Alexander Weiss
83c8a9b058
Bugfix: packSizeFromList should save size from List()
2020-12-05 20:58:36 +01:00
Michael Eischer
f72f6c9c80
Fix debug build
2020-11-29 18:44:36 +01:00
MichaelEischer
52b98f7f95
Merge pull request #3017 from greatroar/files-from0
...
Add backup options --files-from-verbatim and --files-from-raw
2020-11-29 18:15:21 +01:00
Alexander Neumann
04d856e601
Merge pull request #3136 from restic/rawtaz-copy-doc
...
doc: Emphasize double transfer and duplication in copy command
2020-11-29 13:57:10 +01:00
Alexander Neumann
a7b49c4889
Merge pull request #3119 from restic/keep-mountpoints
...
Keep mountpoints as empty directories for --one-file-system
2020-11-29 11:22:12 +01:00
Leo R. Lundgren
f70b10d0ee
doc: Emphasize double transfer and duplication in copy command
2020-11-28 19:49:34 +01:00
greatroar
55bf76ba0c
backup: Add --files-from-{verbatim,raw} options
2020-11-28 18:22:31 +01:00
Alexander Neumann
82ae942965
backup: Keep mountpoints for --one-file-system
...
When a file system is mounted at a directory, lstat() returns attributes
of the root node of the mounted file system, including the device ID of
the other file system. The previous code used when --one-file-system is
specified excluded the directory itself because of that.
This commit changes the code so that mountpoints are kept as empty
directories, its attributes set to the root note of the mounted file
system. The behavior mimics `tar`, which does the same.
2020-11-28 17:00:31 +01:00
Alexander Neumann
f576d3d826
Add tests
2020-11-28 17:00:31 +01:00