2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-16 10:05:25 +00:00
Commit Graph

650 Commits

Author SHA1 Message Date
Fabian Wickborn
69a6e622d0 Add REST backend option to use CA root certificate
Closes #1114.
2017-10-04 22:14:10 +02:00
Alexander Neumann
5d1c1f721e Merge pull request #1324 from antonlindstrom/password-feedback
Add password successful feedback
2017-10-04 21:31:24 +02:00
Alexander Neumann
cdef55bb88 Merge pull request #1312 from hgfischer/issue-1119
nit: please remove dot imports #1119
2017-10-04 21:01:40 +02:00
Anton Lindstrom
a7baea0522 Output password successful on terminal stdout
This removes the conditions that checks if the password is supplied
through environment variable or file and outputs password is successful
on terminal and when --quiet is not supplied.
2017-10-04 14:55:04 +02:00
Anton Lindstrom
55e6003749 Add password successful feedback
This adds some feedback when entering the password on the command line.
When the password is entered and supplied through stdin (and stdout is a
terminal) then the a message saying `password is correct` if correct is
printed.
2017-10-04 13:45:05 +02:00
Alexander Neumann
657a1d75af snapshots: Add short ID to JSON output
We're using the short ID in all output to users, so it should also be
included in the JSON output of the `snapshots` command.
2017-10-03 15:24:09 +02:00
Anton Lindstrom
d46314648e Add explicit OK output to check command
This adds additional output to the check command when no errors were
found. It means that when all checks have been completed, the following
output is displayed:

	No errors were found

The output is added to make sure that it is easier to understand that no
errors were found.

Full example output:

	Create exclusive lock for repository
	Load indexes
	Check all packs
	Check snapshots, trees and blobs
	No errors were found
2017-10-03 12:57:51 +02:00
Alexander Neumann
e45011af57 Merge pull request #1304 from jannickfahlbusch/showAmountOfSnapshots
Show the number of snapshots
2017-10-03 12:41:47 +02:00
Alexander Neumann
fb09884893 Merge pull request #1311 from felix9/dump-no-trees
"dump" command no longer has a "trees" option
2017-10-03 12:40:24 +02:00
Alexander Neumann
d1eecafa63 Merge pull request #1314 from jannickfahlbusch/fixTypo
Fix typo in comment
2017-10-03 12:39:24 +02:00
Alexander Neumann
034b0b8040 forget: Run prune for manually forgotten snapshots 2017-10-03 11:56:13 +02:00
Jannick Fahlbusch
3dcacb3730
Fix typo in comment 2017-10-02 18:19:22 +02:00
Herbert
033589a66b Use rtest on these as well to keep codebase consistent 2017-10-02 17:48:08 +02:00
Jannick Fahlbusch
e46a647c45
Just print the number of snapshots 2017-10-02 17:05:59 +02:00
Herbert
3473c3f7b6 Remove all dot-imports 2017-10-02 15:06:39 +02:00
Jannick Fahlbusch
2f10e25738
Show the amount of snapshots 2017-10-01 17:14:54 +02:00
Felix Lee
555bd257bd dump command no longer has 'trees' option 2017-10-01 08:04:52 -07:00
Alexander Neumann
dad1c87afe Rework generation of manpages and completion files
This commit removes the `manpages` and `autocomplet` commands and
replaces them with the more generic `generate` command. Also, zsh
completion file support was added.
2017-09-26 13:12:12 +02:00
Alexander Neumann
56fccecd06 prune: Repack mixed pack files 2017-09-24 21:54:53 +02:00
Alexander Neumann
62ba9f1950 check: Disable cache by default 2017-09-24 21:54:53 +02:00
Alexander Neumann
610b676444 Automatically exclude current restic cache 2017-09-24 21:54:53 +02:00
Alexander Neumann
9be24a1c9f Add cache
This commits adds rudimentary support for a cache directory, enabled by
default. The cache directory is created if it does not exist. The cache
is used if there's anything in it, newly created snapshot and index
files are written to the cache automatically.
2017-09-24 21:54:53 +02:00
Fabian Wickborn
ea1ab96749 Always sort snapshots lists ascending by timestamp
Fixes #1219.
2017-09-24 13:01:13 +02:00
Alexander Neumann
9c6b7f688e Merge pull request #1270 from restic/sftp-allow-password-prompt
sftp: Allow password entry
2017-09-23 22:13:04 +02:00
Alexander Neumann
fb9729fdb9 sftp: Allow password entry
This was a bit tricky: We start the ssh binary, but we want it to ignore
SIGINT. In contrast, restic itself should process SIGINT and clean up
properly. Before, we used `setsid()` to give the ssh process its own
process group, but that means it cannot prompt the user for a password
because the tty is gone.

So, now we're passing in two functions that ignore SIGINT just before
the ssh process is started and re-install it after start.
2017-09-23 11:43:33 +02:00
Alexander Neumann
45a09c76ff Allow suspending SIGINT handler 2017-09-23 11:12:56 +02:00
Dmitriy Morozov
ae60188eb9 Add --compact option to forget 2017-09-22 16:32:59 -07:00
Alexander Neumann
e7de3b5f9d Merge pull request #1266 from JaCoB1123/document_hostname_option
Add note about rescan to hostname flag (fixes #1221)
2017-09-22 15:40:24 +02:00
Jan Bader
727fb6eabe Add note about rescan to hostname flag (fixes #1221) 2017-09-22 14:29:04 +02:00
Alexander Neumann
a4577769ae Merge pull request #1262 from mafgh/bytes
fix duplicate bytes in prune output
2017-09-22 11:59:10 +02:00
Stefan Völkel
7f927d4774 fix duplicate bytes in prune output 2017-09-22 10:07:24 +02:00
Tobias Klein
1a83a739dc fuse: added symlink 'latest' to snapshots-dir 2017-09-21 16:41:20 +02:00
Alexander Neumann
d7e644272f prune: Add plausibility check 2017-09-19 10:50:07 +02:00
Alexander Neumann
fca9a523e9 Merge pull request #1241 from restic/fix-timestamp-check
Use .Equal() instead of == for time.Time
2017-09-16 14:54:26 +02:00
Alexander Neumann
a60e751217 Use .Equal() instead of == for time.Time
Closes #1238
2017-09-15 20:57:35 +02:00
Alexander Neumann
81c5d8a968 Correct bash completion file path 2017-09-15 20:45:16 +02:00
Alexander Neumann
c8c01a5cae Merge pull request #1223 from mrzv/snapshots-compact
Add --compact option to snapshots
2017-09-13 14:02:31 +02:00
Alexander Neumann
0f25ef9498 Merge pull request #1230 from shayneholmes/update-short-help
Update style in short help commands
2017-09-11 22:25:31 +02:00
Alexander Neumann
36eaa22ed0 Merge pull request #1205 from mungomat/backup_time
Backup time
2017-09-11 19:01:41 +02:00
Shayne Holmes
9eb39cef05 Capitalize short help commands
Unify existing Cobra help command, and git-help's style.
2017-09-11 09:32:44 -07:00
Shayne Holmes
ee6150f67c Change short help messages to imperative voice
Unify the output of `restic help`.
2017-09-11 09:26:13 -07:00
Alexander Neumann
b1af544b1d Merge pull request #1224 from restic/improve-exclude-caches
Allow multiple exclude-if-present
2017-09-11 17:31:24 +02:00
Dmitriy Morozov
7a221f2473 Run changes through gofmt 2017-09-10 15:09:28 -07:00
Dmitriy Morozov
bdbe956c5c Add --compact option to snapshots
With --compact, snapshots doesn't list directories and puts all tags on a single
line. This way each snapshot takes up exactly one line.
2017-09-10 13:06:43 -07:00
Alexander Neumann
b6aeea425b Merge pull request #1196 from mungomat/forget_groupByTagsOnly
forget: group-by-tags-only
2017-09-10 20:52:15 +02:00
Alexander Neumann
a8aa4eb06c Rename parameter filename -> path 2017-09-10 20:28:21 +02:00
Alexander Neumann
0b2947dedb Add test for rejectByPattern 2017-09-10 15:31:58 +02:00
Alexander Neumann
47ddd34266 Improve test 2017-09-10 15:20:41 +02:00
Alexander Neumann
2fdca5d310 Improve debug message 2017-09-10 15:16:05 +02:00
Alexander Neumann
e5d4e33509 Improve error message if no targets specified 2017-09-10 15:14:11 +02:00
Alexander Neumann
e117f613af Move device test into new RejectFunc 2017-09-10 15:13:40 +02:00
Alexander Neumann
0dfdf02885 Rework pattern excludes 2017-09-10 14:34:28 +02:00
Alexander Neumann
4a0129fc2b Rename excludeByFile -> rejectIfPresent 2017-09-10 14:25:58 +02:00
Alexander Neumann
a9c705009c Move reject functions to new file 2017-09-10 14:25:25 +02:00
Alexander Neumann
d937ad8cf6 Rename FilenameCheck to RejectFunc
We already have the opposite: pipe.SelectFunc(item string, fi
os.FileInfo) bool, so RejectFunc is a good name.
2017-09-10 14:21:51 +02:00
Alexander Neumann
36e70228f2 Handle invalid key file 2017-09-10 10:55:01 +02:00
Alexander Neumann
c22c582546 Allow multiple exclude-if-present 2017-09-09 21:24:29 +02:00
Alexander Neumann
ea75509d6e Print warning for non-existing items 2017-09-09 21:12:41 +02:00
Tobias Klein
ed30bd7b76 gofmt 2017-09-09 18:19:19 +02:00
Tobias Klein
8f9ef4402b error in case of unknown grouping option 2017-09-09 15:55:37 +02:00
Tobias Klein
43ff971dfd new sub-option for backup: time
New option to specify the timestamp for a backup
2017-09-09 13:26:35 +02:00
Fabian Wickborn
dbda892542 Add option to exclude directories with a tagfile
The option is named --exclude-if-present and accepts a parameter
filename[:content]. Directories are excluded and their contents is not
backed up if they contain a file with the specified name and,
optionally, that starts with the specified content. The tagfile itself
is never excluded.

There is also a shortcut --exclude-caches that works in the same way as
the likewise-named option of tar(1): Directories are recognized as cache
if they contain a file named "CACHEDIR.TAG.

Closes #317.
2017-09-09 09:57:42 +02:00
Tobias Klein
1073bfba37 flexible grouping option for the forget-command 2017-09-06 20:14:18 +02:00
Alexander Neumann
fa2ee78a5c Merge pull request #1044 from lloeki/982-improve-restore
Improve restore
2017-09-04 21:51:12 +02:00
Tobias Klein
e4a5cdc5bc forget: group-by-tags-only 2017-09-03 17:11:25 +02:00
Alexander Neumann
0ee1650f82 Merge pull request #1191 from prattmic/profile
debug: properly handle interrupted profiles
2017-09-03 09:49:46 +02:00
Alexander Neumann
de8c64e767 Use deterministic date for man pages 2017-09-02 09:27:11 +02:00
Michael Pratt
e4c469c149 debug: properly handle interrupted profiles
By default (i.e., without profile.NoShutdownHook), profile.Start listens
for SIGINT and will stop the profile and call os.Exit(0).

restic already listens for SIGINT and runs its own cleanup handlers
before calling os.Exit(0).

As is, these handlers are racing when an interrupt occurs, and in my
experience, restic tends to win the race, resulting in an unusable
profile.

Eliminate the race and properly stop profiles on interrupt by disabling
package profile's signal handler and instead stop the profile in a
restic cleanup handler.
2017-08-28 22:03:26 -07:00
Ricardo Seriani
62ed776a8c Change key rm command to key remove
Change key rm command to key remove, to follow manual and other commands
2017-08-17 11:03:26 -03:00
Loic Nageleisen
f880ff21aa Fixing restore with excluded
An exclude filter is basically a 'wildcard but foo', so even if a
childMayMatch, other children of a dir may not, therefore childMayMatch
does not matter, but we should not go down unless the dir is selected
for restore.
2017-08-16 15:25:02 +02:00
Loic Nageleisen
4a36993c19 Smarter filter when children won't match
This improves restore performance by several orders of magniture by not
going through the whole tree recursively when we can anticipate that no
match will ever occur.
2017-08-16 15:25:02 +02:00
Alexander Neumann
b67c178672 Merge pull request #1149 from restic/azure-support
Add Azure blob storage as backend
2017-08-09 21:30:35 +02:00
Dipta Das
ba75a3884c Add Google Cloud Storage as backend
Environment variables:
GOOGLE_PROJECT_ID=gcp-project-id
GOOGLE_APPLICATION_CREDENTIALS=path-to-json-file

Environment variables for test:
RESTIC_TEST_GS_PROJECT_ID=gcp-project-id
RESTIC_TEST_GS_APPLICATION_CREDENTIALS=path-to-json-file
RESTIC_TEST_GS_REPOSITORY=gs:us-central1/test-bucket

Init repository:
$ restic -r gs🪣/[prefix] init
2017-08-06 21:47:55 +02:00
Alexander Neumann
d91d89eef6 azure: Create container if it does not exist 2017-08-06 21:47:04 +02:00
Dipta Das
3a85b6b7c6 Add Azure Blob Storage as backend
Environment variables:
AZURE_ACCOUNT_NAME=storage-account-name
AZURE_ACCOUNT_KEY=storage-account-key

Environment variables for test:
RESTIC_TEST_AZURE_ACCOUNT_NAME=storage-account-name
RESTIC_TEST_AZURE_ACCOUNT_KEY=storage-account-key
RESTIC_TEST_AZURE_REPOSITORY=azure:restic-test-container

Init repository:
$ restic -r azure:container-name:/prefix/dir init
2017-08-06 21:47:04 +02:00
Alexander Neumann
6bc43a4198 manpage: Remove auto gen tag from man page 2017-08-06 21:31:01 +02:00
Alexander Neumann
e348b3deeb manpage: Do not panic when no command is given 2017-08-06 21:01:49 +02:00
Alexander Neumann
739350fd8e backup: Do not print hostname in help text
This is necessary so that the manpage generation is deterministic and we
can test if the man pages are up to date when the CI tests run.
2017-08-05 12:05:53 +02:00
Alexander Neumann
a3ab17b470 Add 'manpage' command to generate manual pages 2017-08-05 10:57:01 +02:00
Johannes Kohnen
37aad2e3aa Close exclude files and check errors 2017-08-01 17:34:27 +00:00
donat
893bc9f777 Error message in case PasswordFile is missing 2017-07-27 14:23:08 +03:00
Michael Stapelberg
b89d3cc4d0 fix typo: explicitely → explicitly 2017-07-27 08:24:53 +02:00
Alexander Neumann
2e804511ca Merge pull request #1133 from middelink/fix-1132
Force restic to ask the password when adding a key.
2017-07-26 22:11:37 +02:00
Pauline Middelink
c95e2b009e Simpify cmd_backup and cmd_init now we have the password in gopts. 2017-07-24 23:32:55 +02:00
Pauline Middelink
d5615a67c8 Refactor password resolving.
Instead of determining the password lazily during ReadPassword(), do so now in
cobra.PersistentPreRunE() so we can store the result in the globalOptions and
reuse/override when applicable without having to worry about the environment
or flag options interfering.
2017-07-24 23:05:37 +02:00
Pauline Middelink
d9b9bbd4a8 Force restic to ask the password when adding a key.
As `restic key add` uses the same `ReadPasswordTwice()` as the
rest of restic, it is sensitive to the environment variable
RESTIC_PASSWORD or --password-file= override.

When asking for the new key, temporary remove these 2 overrides, forcing
the password to be asked.
2017-07-24 22:00:44 +02:00
Alexander Neumann
d780b1eede Rework withTestEnvironment
Switch from a function passed as a parameter to a cleanup function,
which is also executed when the test function panics, so no temporary
directories are left behind.
2017-07-24 21:32:34 +02:00
Pauline Middelink
1717391f6c Fuse testing leaves test mountpoint around. Move it under the testing tree which is removed after each test. 2017-07-24 20:33:39 +02:00
Alexander Neumann
23c903074c Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
Alexander Neumann
94b27e8933 Fix paths for tests 2017-07-23 14:39:57 +02:00
Alexander Neumann
6caeff2408 Run goimports 2017-07-23 14:21:03 +02:00
Alexander Neumann
83d1a46526 Moves files 2017-07-23 14:19:13 +02:00
Alexander Neumann
b63399d606 Move things around for gb
This moves all restic source files to src/, and all vendored
dependencies to vendor/src.
2016-02-20 17:31:20 +01:00
Alexander Neumann
1287b307ac Add cleanup handler to restore terminal state
Closes #402
2016-02-13 18:29:26 +01:00
Alexander Neumann
4ec5050cbb backup: Hide status output for narrow terminals
closes #428
2016-02-10 17:28:48 +01:00
Rached Ben Mustapha
ba35ca522a Handle pack loading errors in rebuild-index
Errors returned from backend.LoadAll() were not handled, leading to
these fatal errors from the unpacker trying to read the size from the end of
an empty buffer:

`seeking to read header length failed: bytes.Reader.Seek: negative position`

This change takes care of returning on error, as well as showing which pack
failed to load and validating pack integrity.
2016-02-07 18:30:47 +00:00
Alexander Neumann
2c3a6a6fa9 cmd_rebuild_index: Remove calls to GetReader() 2016-01-24 00:42:04 +01:00
Alexander Neumann
61551b0591 cmd_cat: Remove calls to GetReader() 2016-01-24 00:42:04 +01:00
Alexander Neumann
f05a32509e Add "Test" prefix to backend test functions 2016-01-23 19:12:02 +01:00
Alexander Neumann
6ba56befad Abort fuse integration test on error
Before, the fuse integration test was run and the tests were never
finished, because the testing code did not detect any errors when the
fusermount binary returned an error. This commit fixes it.
2016-01-23 19:10:43 +01:00
Alexander Neumann
8b7bf8691d backend: Remove Get()
This is the first commit that removes the (redundant) Get() method of
the backend interface. Get(x, y) is equivalent to GetReader(x, y, 0, 0).
2016-01-23 13:13:05 +01:00
Alexander Neumann
1dd4c52a8b Add comments, configure flag library 2016-01-17 18:48:05 +01:00
Alexander Neumann
1922a4272c s3: fix usage
Ignore error response for existing bucket, add more debug code.
2016-01-17 18:48:05 +01:00
Alexander Neumann
7d5f8214cf use new backend open with config 2016-01-17 18:48:05 +01:00
Alexander Neumann
3ac1d0e4d1 add progress 2015-12-06 17:29:31 +01:00
Alexander Neumann
0e66a66bce read packs concurrently 2015-12-06 17:09:06 +01:00
Alexander Neumann
a1440c819b Make NoLock a global option 2015-11-13 12:33:59 +01:00
Alexander Neumann
6edb7e02d0 Allow restoring and listing without locking 2015-11-10 22:13:53 +01:00
Alexander Neumann
c79dcbd7c4 Allow checking a read-only repo with --no-lock 2015-11-10 21:41:22 +01:00
Alexander Neumann
acba82c8f7 Merge pull request #252 from restic/repack-blobs
WIP: Repack blobs
2015-11-09 20:57:57 +01:00
Alexander Neumann
1f9aea9905 fix test on windows, reset read-only flag 2015-11-08 22:41:45 +01:00
Alexander Neumann
742d69bf4d Add another test for optimizing unused blobs 2015-11-08 22:38:17 +01:00
Alexander Neumann
5776b8f01c remove ConvertIndex 2015-11-08 22:27:13 +01:00
Alexander Neumann
2e6eee991d Add test for optimize command with old indexes 2015-11-08 22:21:08 +01:00
Alexander Neumann
43e2c9837e check: removing orphaned packs is handled in 'optimize' 2015-11-08 21:24:51 +01:00
Alexander Neumann
c4fc7b52ae Add 'optimize' command that repacks blobs 2015-11-08 21:10:03 +01:00
Alexander Neumann
cd948b56ac cmd_check: Don't display unused blobs by default 2015-11-08 20:46:52 +01:00
Alexander Neumann
ea41a1045f Add integration test for error on readdirnames 2015-11-06 23:19:56 +01:00
Alexander Neumann
18d7f7f835 Read password from stdin if terminal is not a tty 2015-11-04 22:20:58 +01:00
Alexander Neumann
1fc0d78913 Refactor Index.Store() to take a PackedBlob 2015-11-02 19:07:03 +01:00
Alexander Neumann
50c2f2e87f cmd_cat: allow dumping raw tree blobs 2015-11-02 17:36:04 +01:00
Alexander Neumann
fccde030d5 Refactor Index.Lookup() to return struct PackedBlob 2015-10-31 14:47:42 +01:00
Alexander Neumann
b5976474dd backup: add debug output for excluded files/dirs 2015-10-27 22:34:30 +01:00
Alexander Neumann
00e05ae3c9 bugfix: close pack files after reading the header 2015-10-27 20:39:52 +01:00
Alexander Neumann
74cd134b54 rebuild index: remember already stored blobs 2015-10-25 22:34:22 +01:00
Alexander Neumann
734ae7fcb8 Add test for corner case
It was observed that a restic repository still contained overlapping
indexes after `rebuild-index` has been called. This is caused by
instantly forgetting that blobs have already been saved once a full
index has been written during index rebuilding.

This commit adds a (failing) test that shows the behaviour.
2015-10-25 21:51:57 +01:00
Alexander Neumann
7b8e42a763 Silence rebuild-index tests 2015-10-25 21:51:46 +01:00
Alexander Neumann
efbce9f0fa rebuild-index: handle not yet indexed packs 2015-10-25 18:07:51 +01:00
Alexander Neumann
88849c06a6 rebuild-index: Refactor a bit 2015-10-25 17:53:02 +01:00
Alexander Neumann
6aed9f268b Add command rebuild-index 2015-10-25 17:24:52 +01:00
Alexander Neumann
96ecc26507 Let the checker return a list of hints along with errors 2015-10-25 16:26:50 +01:00
Alexander Neumann
650eab6a0e Fix typo in dump usage 2015-10-25 13:19:35 +01:00
Alexander Neumann
7ab9915859 Fix 'dump' command 2015-10-12 22:42:31 +02:00
Alexander Neumann
86fcd170f6 Add and use MasterIndex 2015-10-12 22:34:12 +02:00
Alexander Neumann
de2c20be84 Dump individual indexes 2015-10-12 20:53:07 +02:00
Alexander Neumann
db85ab8aa0 Use the correct channel for sending errors 2015-10-11 19:13:45 +02:00
Chapuis Bertil
c765688779 find command integration tests 2015-08-28 19:31:05 +02:00
Chapuis Bertil
d4686ebcc5 Load the index and search subtree 2015-08-27 23:21:44 +02:00
Alexander Neumann
fcb769fa3b Merge pull request #262 from restic/fix-tests
Fix tests
2015-08-18 22:45:50 +02:00
Alexander Neumann
1a47ea4ab8 test helpers: add RemoveAll and ResetReadOnly
This is mainly needed in Windows, where files and dirs cannot be
removed unless they are writeable.
2015-08-18 21:40:40 +02:00
klauspost
a3570af500 Create separate disEntry.equals for Windows.
Windows does not have UID/GID the same way as unix,
so we don't attempt to compare them.
2015-08-17 11:10:12 +02:00
klauspost
d5dab39a4a Disable FUSE test on Windows. 2015-08-17 11:02:04 +02:00
Klaus Post
4dc746dac2 Change repository type detection to first check if path is a directory that exists.
The method of determining if a repository exists doesn't work on Windows, since
the "url.Scheme" will contain the drive letter - "c" in "c:\backup",
so as a first step we check if the URL can be opened as a file,
and if so, we assume it is a 'local' type repository.
2015-08-14 15:39:16 +02:00
Klaus Post
fb3778abb6 Disable mount command on Windows.
FUSE does not support Windows, so we disable it on Windows.
2015-08-14 15:33:11 +02:00
Alexander Neumann
dde0fd8421 Add option to use root as owner of files/dirs 2015-07-26 20:56:27 +02:00
Alexander Neumann
05e2afba0b Merge pull request #249 from restic/reduce-fuse-memory-usage
Reduce memory usage for fuse mount
2015-07-26 19:20:13 +02:00
Alexander Neumann
b85927576b Address code review comments 2015-07-26 18:01:20 +02:00
Alexander Neumann
d1629e1e4e fuse: move to top level 2015-07-26 17:20:26 +02:00
Alexander Neumann
bd746a0425 fuse: refactor and add tests for fuse.file 2015-07-26 16:43:42 +02:00
Alexander Neumann
9753c37e31 Remove dead code
This removes dead code (functions that aren't called) detected with
`deadcode`.
2015-07-26 14:56:34 +02:00
Alexander Neumann
55ddd5317d Reduce memory usage for fuse mount
This changes `repository.LoadBlob()` so that a destination buffer must
be provided, which enables the fuse code to use a buffer from a
`sync.Pool`. In addition, release the buffers when the file is closed.
At the moment, the max memory usage is defined by the max file size that
is read in one go (e.g. with `cat`). It could be further optimized by
implementing a LRU caching scheme.
2015-07-26 14:25:59 +02:00
Alexander Neumann
054256468b Fix message display for parent snapshot id 2015-07-25 18:10:23 +02:00
Alexander Neumann
5cdcc99eba Use array instead of hash for backend.ID
Since backend.ID is always a slice of constant length, use an array
instead of a slice. Mostly, arrays behave as slices, except that an
array cannot be nil, so use `*backend.ID` insteaf of `backend.ID` in
places where the absence of an ID is possible (e.g. for the Subtree of a
Node, which may not present when the node is a file node).

This change allows to directly use backend.ID as the the key for a map,
so that arbitrary data structures (e.g. a Set implemented as a
map[backend.ID]struct{}) can easily be formed.
2015-07-25 18:01:57 +02:00
Alexander Neumann
deaca157fe restore: ignore errors
Also add a test for restoring a file that is owned by root. Closes #244.
2015-07-25 12:59:59 +02:00
Alexander Neumann
cc34401152 Record exclude patterns in snapshot
This adds the exclude patterns used to create a backup in the snapshot,
so we can later compute statistics (like git does) on the data
structure, e.g. added/removed files etc. For that, we need the exclude
pattern.
2015-07-22 22:43:32 +02:00
Alexander Neumann
9911d46996 fuse: rename child/children -> node/items 2015-07-21 21:34:59 +02:00
Alexander Neumann
3f4b5b8d48 fuse/mount: display symlinks properly 2015-07-21 21:25:05 +02:00
Alexander Neumann
1ac72b8813 Fix style issue 2015-07-21 21:24:06 +02:00
Alexander Neumann
99dae57b4f fuse: use node.Type instead of node.Mode 2015-07-21 21:23:40 +02:00
Alexander Neumann
aeb5a694d3 Merge pull request #238 from restic/fix-checks-on-bsd
Refactor skipping symlink timestamp checks on *bsd and darwin
2015-07-21 19:47:33 +02:00
Alexander Neumann
258b6a77ee Refactor skipping symlink ModTime checks, add OpenBSD 2015-07-20 21:29:21 +02:00
Alexander Neumann
bd3ce5d4a3 Fix tests on freebsd 2015-07-20 21:08:29 +02:00
Alexander Neumann
1da89253cf Add include filter for restore
Include and exclude filter are mutually exclusive.
2015-07-20 19:21:01 +02:00
Alexander Neumann
c0337a2675 Add exclude filter to restorer and 'restore' command 2015-07-20 19:21:01 +02:00
Alexander Neumann
7fd52f9f57 Add exclude filter to archiver and 'backup' command 2015-07-20 19:21:01 +02:00
Matthieu Rakotojaona
3767eb2675 Unmount and remove directory for mount in tests 2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
e44716381c Unmount when closing application from cli 2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
eadfcd3f9e Add waitForMount for OSX 2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
fe6f1c01f3 Make inodeFromBackendId more explicit 2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
a4d122e5ae Cleanup mount after test 2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
d7888d4dd5 Fix checks in fuse tests 2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
ca6b7ec533 Add Index.LookupSize 2015-07-19 23:04:18 +02:00
Matthieu Rakotojaona
b1426826cc Extract fuse structs 2015-07-19 23:03:33 +02:00
Matthieu Rakotojaona
0606b9884e Make file.Read more intelligible 2015-07-19 23:03:33 +02:00
Matthieu Rakotojaona
3731a94367 Use functions to create names 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
a016f82051 Fix coding style 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
e654a9659c Protect the snapshots cache with a RWMutex 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
0e7c1668d5 Make mountpoint readable by owner only 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
9ff98d34ef Add build and test instructions
* Don't build on openbsd
* Don't test fuse on travis
2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
1f79a19293 Comment the go trick about static verification of a struct implementing an interface 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
a8cd74ba7e Cache known snapshots instead of re-traversing the repository every time 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
c9b3eebc09 Check that mountpoints are created 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
25b090a074 Add integration tests for mount command 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
414ade5b3f Signal readiness of mount to potential callers 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
a6ce7d9845 Use more restic-y idioms 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
3a82612244 Update bazil.org/fuse version 2015-07-19 23:03:32 +02:00
Matthieu Rakotojaona
32a321e51e Add simple mount command 2015-07-19 23:03:32 +02:00
Alexander Neumann
76817da922 Run cleanup handlers in main function 2015-07-19 17:57:18 +02:00
Alexander Neumann
dac89bf544 Allow more than one cleanup handler 2015-07-19 17:50:55 +02:00
Alexander Neumann
159b9e80c4 cmd/restic: implement lock refresh 2015-07-12 22:10:01 +02:00
Alexander Neumann
d36f07c6eb checker: add option to remove orphaned packs 2015-07-12 17:14:10 +02:00
Alexander Neumann
af02c323cd checker: use channel of error instead of slice 2015-07-12 01:46:10 +02:00
Alexander Neumann
04f172b38d checker: Add checker and tests 2015-07-11 16:27:41 +02:00
Alexander Neumann
54c4c29a89 Add checker and command 'check' to replace 'fsck' 2015-07-11 16:27:38 +02:00
Alexander Neumann
389ec9b101 Add tests for restore filter 2015-07-09 20:12:31 +02:00
Alexander Neumann
3e0a97fb13 Fix restore filter
Internally rename restorer.Filter -> restorer.SelectForRestore to make
semantic clear.

In addition, swap parameters to filepath.Match() so that the pattern can
really be matched.

Limitation: The filter only works on the filename, not on any path
component, e.g. '*.go' selects all go files, 'subdir/foo*' doesn't
select anything.

Fixes #202.
2015-07-09 20:12:31 +02:00
Florian Weingarten
c2d5a9209e fix darwin integration tests 2015-07-09 11:13:40 -04:00
Alexander Neumann
57eb1a4eea cmd_backup: filter non-existing target files/dirs 2015-07-06 23:02:16 +02:00
Alexander Neumann
c8bb688e26 Command snapshots: do not list first dir twice 2015-07-06 22:26:31 +02:00
Alexander Neumann
03983f0907 repository: Rename Load() -> LoadAndDecrypt() 2015-07-05 11:07:10 +02:00
Alexander Neumann
281eea9c05 sftp: Use own process group for ssh subprocess 2015-07-05 11:07:10 +02:00
Alexander Neumann
e657287eac cmd/restic: Add command unlock, improve error message 2015-06-28 13:52:23 +02:00
Alexander Neumann
47212dde8c cmd/restic: Do not require exclusive lock for listing keys 2015-06-28 13:52:22 +02:00
Alexander Neumann
13e9a35f96 cmd/restic: Add lock handling, interrupt cleanup 2015-06-28 13:52:22 +02:00
Alexander Neumann
65a0def949 cmd/restic: Add locks to commands 2015-06-28 13:52:22 +02:00
Alexander Neumann
7d2699b429 cmd/restic: Rename variable, no functional changes 2015-06-28 13:52:22 +02:00
Alexander Neumann
d51fd436b5 Add locking functions 2015-06-28 13:52:22 +02:00
Florian Weingarten
f8c30556d3 Ask for password after create repo succeeded 2015-06-26 13:58:43 -04:00
Alexander Neumann
9e9177ab73 Add build.go 2015-06-24 20:29:58 +02:00
Alexander Neumann
d5020ac109 Fix debug functions 2015-06-24 20:00:01 +02:00
Alexander Neumann
6c2d6bfd11 Merge pull request #184 from howeyc/backend-s3
Add Amazon S3 backend.
2015-06-23 20:14:47 +02:00
Alexander Neumann
0005191d71 Remove dirdiff and gentestdata 2015-06-21 17:40:22 +02:00
Alexander Neumann
5ae04b6834 Add last integration tests, remove testsuite 2015-06-21 17:40:22 +02:00
Alexander Neumann
43d4558a90 Add test for backing up non-existing directories 2015-06-21 17:40:22 +02:00
Alexander Neumann
675f341b6d Output warnings/errors to configurable writer 2015-06-21 17:40:22 +02:00
Alexander Neumann
cfaf8ab8a6 Add integration test for key handling 2015-06-21 17:40:22 +02:00
Alexander Neumann
a99a460b32 Fix integration tests 2015-06-21 17:40:22 +02:00
Alexander Neumann
a43733d552 Introduce Verbosef 2015-06-21 17:40:22 +02:00
Alexander Neumann
4388474cdc Restructure cmd/restic, no functional changes 2015-06-21 17:40:22 +02:00
Alexander Neumann
2fa259816b rename opts to mainOpts 2015-06-21 17:40:22 +02:00
Alexander Neumann
1216ded14b Add integration test for key command 2015-06-21 17:40:22 +02:00
Alexander Neumann
e2563b3eca Fix comments 2015-06-21 17:40:22 +02:00
Alexander Neumann
a176b1b5a6 Add more integration tests 2015-06-21 17:40:22 +02:00
Alexander Neumann
9853fbcf48 Remove more flags from tests 2015-06-21 17:40:21 +02:00
Alexander Neumann
3a65f27c3f Automatically find fixtures for integration test 2015-06-21 17:40:21 +02:00
Alexander Neumann
030f08a410 Remove flags from tests 2015-06-21 17:40:21 +02:00
Alexander Neumann
d8d09b6d69 Fix restic configuration for integration tests 2015-06-21 17:40:21 +02:00
Alexander Neumann
12677b4f8a Use flag instead of build tag to run integration tests 2015-06-21 17:40:21 +02:00
Alexander Neumann
7c107acf0b More integration tests 2015-06-21 17:40:21 +02:00
Alexander Neumann
954025e399 Add integration test with the go testing framework 2015-06-21 17:40:21 +02:00
Chris Howey
47186806cf Add Amazon S3 backend. 2015-06-14 08:28:50 -05:00
Alexander Neumann
9c375ea382 Refactor backup a bit 2015-06-07 19:08:37 +02:00
Alexander Neumann
fd80499954 Refactor terminal recognition, add --quiet parameter 2015-06-07 18:30:11 +02:00
Alexander Neumann
f5537e7a0e Refactor configuration of cache dir and repository 2015-06-07 18:15:03 +02:00
Alexander Neumann
848793df84 Remove unused file 2015-06-07 18:13:22 +02:00
Alexander Neumann
0314d2b0c3 fsck: Fix check for orphaned blobs 2015-05-17 23:41:53 +02:00
Alexander Neumann
df1e3e03e9 Add 'dump' command
'dump' writes internal data structes pretty-printed as JSON to stdout.
This was done to debug fsck error messages.

In contrast to the 'cat' command, this one prints the data structures as
there are interpreted by restic, not as they are stored in the
repository. This means that only the merged index from all the index
files is printed out.

This is meant for debugging only, it's compiled only when the "debug"
tag is active.
2015-05-17 23:15:08 +02:00
Alexander Neumann
af381c2ab0 Remove Repository.Remove() 2015-05-17 20:58:22 +02:00
Alexander Neumann
eb6dfcf58c Remove Repository.Test() 2015-05-17 20:58:22 +02:00
Alexander Neumann
6e38a8a033 Move FindSnapshot, make Repository.List() return IDs 2015-05-17 20:58:22 +02:00
Florian Weingarten
bace4607bf Fix ModTime for directories 2015-05-13 23:11:31 -04:00
Alexander Neumann
95536e8a21 Rename 'Repo' -> 'Repository' 2015-05-09 23:59:58 +02:00
Alexander Neumann
232c472836 Move package 'repo' to package 'repository' 2015-05-09 23:52:03 +02:00
Alexander Neumann
b2dcdf00e3 Merge pull request #178 from restic/refactor-server
Rename Server -> Repository
2015-05-09 22:59:02 +02:00
Alexander Neumann
ae21938f3e Rename 'Repository' -> Repo 2015-05-09 17:41:28 +02:00
Alexander Neumann
cd4c56b927 wip 2015-05-09 13:54:47 +02:00
Alexander Neumann
d9b5832034 Rename variables 2015-05-09 13:47:21 +02:00
Alexander Neumann
87ebf12945 Rename 'Server' to 'Repository' 2015-05-09 13:25:52 +02:00
Alexander Neumann
8be9e95d20 Rename package 'server' to 'repo' 2015-05-09 13:24:15 +02:00
Alexander Neumann
861e1b9910 Add doc stubs to all the packages 2015-05-09 13:00:01 +02:00
Chris Howey
e8615eb593 Fix ls command
Added missing loadindex call. Also fixed the recursive call to
use the subtree to stop infinte recursion.
2015-05-05 20:50:10 -05:00
Alexander Neumann
bdbb3ab329 Remove pools.go 2015-05-05 00:14:07 +02:00
Alexander Neumann
35af933f24 server: Rename CreateMasterKey() to Init() 2015-05-04 20:40:17 +02:00
Alexander Neumann
1213d87b1a server: Only save crypto.Key
At the moment, the server doesn't need the full server.Key (master and
user key), just the master key.
2015-05-03 18:56:20 +02:00
Alexander Neumann
765e3dc66f restic: Add 'cat config' command 2015-05-03 18:56:20 +02:00
Alexander Neumann
d4bf5bb279 server: Add config 2015-05-03 18:56:20 +02:00
Alexander Neumann
bebb08ee7e server/key: Rename CreateKey -> CreateMasterKey 2015-05-03 18:56:20 +02:00
Alexander Neumann
9b54fd7bdb server: rename LoadJSONEncrypted -> LoadJSONUnpacked 2015-05-03 18:56:20 +02:00
Alexander Neumann
b3a75ecc1c Correct usage for backup cmd 2015-05-02 02:05:09 +02:00
Florian Weingarten
0d9360a815 more cleanup 2015-04-29 22:33:34 -04:00
Alexander Neumann
24fc5d343f Remove leftover comment 2015-04-30 00:25:00 +02:00
Alexander Neumann
29ead95c96 Adapt fsck command to packed blobs (unfinished) 2015-04-29 23:27:36 +02:00
Alexander Neumann
60a0fe8349 Major restructure, bundle blobs
This commit also breaks the repository format.
2015-04-29 23:27:32 +02:00
Alexander Neumann
d19b23d4f1 Move Server and Key to new sub-package 2015-04-26 14:46:15 +02:00
Alexander Neumann
6871e1bb58 Merge remote-tracking branch 'fw42/fix_nan_and_inf' 2015-04-26 12:09:14 +02:00
Florian Weingarten
61b1a5b1de Count errors separately and not as files that are "done" 2015-04-26 01:54:35 +00:00
Florian Weingarten
6c776468ab Fix floating point presentation 2015-04-25 13:20:41 -04:00
Alexander Neumann
87a1946417 Merge remote-tracking branch 'fw42/rename_change_to_passwd' 2015-04-25 11:11:27 +02:00
Alexander Neumann
fd472cb59d Use short ID for init 2015-04-25 11:07:51 +02:00
Alexander Neumann
19486987b0 Merge remote-tracking branch 'fw42/mixed_caps' 2015-04-25 11:06:13 +02:00
Florian Weingarten
dead2b7e93 rename "change" to "passwd" 2015-04-25 02:44:26 -04:00
Florian Weingarten
170d147427 Consistent writing 2015-04-24 19:43:27 -04:00
Florian Weingarten
ebae478631 Prefer mixedCaps over underscore 2015-04-24 19:39:32 -04:00
Florian Weingarten
441f4deb66 remember your password 2015-04-24 19:08:05 -04:00
Matthieu Rakotojaona
1d0f8fa80e Take last snapshot as parent by default and allow force re-reading 2015-04-07 22:03:50 +02:00
Alexander Neumann
4d24f2eab3 Correct plen for snapshots 2015-03-28 16:16:19 +01:00
Alexander Neumann
223108c6ae Remove unused vars and const 2015-03-28 15:28:08 +01:00
Alexander Neumann
f157f775da Add checks for Server.Load(), use Blob for load 2015-03-28 15:07:08 +01:00
Alexander Neumann
5e69788eac Refactor backends 2015-03-28 14:36:50 +01:00
Alexander Neumann
53ad706c6d Remove unused 'ram' tool 2015-03-22 21:03:25 +01:00
Alexander Neumann
0ed2a066a0 Document crypto and master key JSON struct 2015-03-22 21:03:01 +01:00
Alexander Neumann
5257c54585 Correct string for catting data blobs 2015-03-22 15:42:46 +01:00
Alexander Neumann
1c0e76ccd6 Bugfix: Backup changed data in incremental mode 2015-03-22 15:09:54 +01:00
Alexander Neumann
cfa2229bc0 Refactor cache refresh for blobs, add progress 2015-03-22 15:09:50 +01:00
Alexander Neumann
865d315ad6 Shorten status output if terminal is small
Closes #107
2015-03-16 20:48:29 +01:00
Alexander Neumann
489cc654e8 Fix ETA display
Closes #111
2015-03-16 20:20:53 +01:00
Alexander Neumann
b17840c6ee Refactor cache and 'cache' command 2015-03-14 12:57:29 +01:00
Alexander Neumann
e1fc17aeb1 Implement per-repository cache 2015-03-14 12:16:28 +01:00
Alexander Neumann
14298fe232 Cache blobs for each snapshot 2015-03-09 23:50:32 +01:00
Alexander Neumann
798ac97a52 Re-enable dedup, add test (closes #95) 2015-03-07 12:05:33 +01:00
Alexander Neumann
f167366be5 Add walk for trees, restructure 2015-03-02 19:58:06 +01:00
Alexander Neumann
c8be54564f Add local cache 2015-03-02 10:04:01 +01:00
Alexander Neumann
a59b0ec1f6 Add progress report for loading blobs 2015-02-21 15:32:48 +01:00
Alexander Neumann
58cded6b75 Refactor progress reporting 2015-02-21 14:25:06 +01:00
Alexander Neumann
a0fea201d9 Reenable Preloading 2015-02-18 23:10:59 +01:00
Alexander Neumann
3bb2aba141 Remove test files 2015-02-18 21:50:59 +01:00
Alexander Neumann
65aae5f8c1 Disable preloading for now 2015-02-17 23:38:15 +01:00
Alexander Neumann
b6f25aa690 Remove Each(), add basic stats 2015-02-17 23:11:56 +01:00
Alexander Neumann
4bb7f2f2ed Add Preloader for blobs 2015-02-17 22:39:44 +01:00
Alexander Neumann
4d1e7b9f24 Change parameters of LoadTree() 2015-02-17 22:37:34 +01:00