Commit graph

496 commits

Author SHA1 Message Date
Thomas Waldmann
9198f6962c implement --progress option for borg delete <archive> 2016-01-16 20:46:49 +01:00
Thomas Waldmann
0213164d46 implement --progress option for borg upgrade, fixes #291 2016-01-16 20:32:24 +01:00
Thomas Waldmann
e68b800d01 remove unused "repair" rpc method
there is no such method in the code.
we use "check" method to repair the repo, so maybe this was left over
from a time when repair was separate from check.
2016-01-16 18:58:52 +01:00
Thomas Waldmann
845d2144cb fix locking, partial fix for #502
the problem was that the borg process removed its own shared lock when upgrading it to an exclusive lock.
this is fine if we get the exclusive lock, but if we don't, we must re-add our shared lock.

this fixes the KeyError in locking.py:217
2016-01-16 18:03:58 +01:00
TW
f35ba0b577 Merge pull request #559 from ThomasWaldmann/metastream-chunker
finer chunker granularity for items metadata stream, fixes #547, fixes #487
2016-01-15 22:42:20 +01:00
TW
d248a7d537 Merge pull request #557 from hansmi/pattern-cleanup
Rename pattern classes and refactor tests
2016-01-15 21:50:04 +01:00
Thomas Waldmann
888e078382 use finer chunker granularity for items metadata stream, fixes #547, fixes #487
the items metadata stream is usually not that big (compared to the file content data) -
it is just file and dir names and other metadata.

if we use too rough granularity there (and big minimum chunk size), we usually will get no deduplication.
2016-01-15 20:56:21 +01:00
TW
b8789f7bde Merge pull request #552 from ThomasWaldmann/hashtable-resizing
Hashtable resizing
2016-01-15 20:54:28 +01:00
Michael Hanselmann
3a39ddbd83 Rename pattern classes for consistency
The class names “IncludePattern” and “ExcludePattern” may have been
appropriate when they were the only styles. With the recent addition of
regular expression support and with at least one more style being added
in forthcoming changes these classes should be renamed to be more
descriptive. “ExcludeRegex” is also renamed to match the new names.
2016-01-15 17:16:25 +01:00
Michael Hanselmann
2c7ab8595d Refactor Unicode pattern tests
The unit tests for Unicode in path patterns contained a lot of
unnecessary duplication. One set of duplication was for Mac OS X (also
known as Darwin) as it normalizes Unicode in paths to NFD. Then each
test case was repeated for every type of pattern.

With this change the tests become parametrized using py.test. The
duplicated code has been removed.
2016-01-15 17:16:25 +01:00
Thomas Waldmann
96f88a29d2 add --list option for borg create
like --stats enables statistics output, --list enables the file/dirs list output.
2016-01-14 18:57:05 +01:00
Michael Hanselmann
b6d0ee7c13 Capitalization fixes for upgrade help epilog 2016-01-14 17:04:34 +01:00
Thomas Waldmann
5cb47cbedd hashindex: explain hash_sizes 2016-01-14 14:39:59 +01:00
Thomas Waldmann
083f5e31ef hashindex: fix upper limit
use num_buckets (== fully use what we currently have allocated)
2016-01-14 14:39:59 +01:00
Thomas Waldmann
09665805e8 move func defs to avoid implicit declaration compiler warning 2016-01-14 14:39:59 +01:00
Thomas Waldmann
91cde721b4 hashindex: minor refactor
- rename BUCKET_(LOWER|UPPER)_LIMIT to HASH_(MIN|MAX)_LOAD
   as this value is usually called the hash table's minimum/maximum load factor.
- remove MAX_BUCKET_SIZE (not used)
- regroup/reorder definitions
2016-01-14 14:39:59 +01:00
Thomas Waldmann
d88df3edc6 hashtable size follows a growth policy, fixes #527
also: refactor / dedupe some code into functions
2016-01-14 14:39:59 +01:00
TW
89169c3f87 Merge pull request #542 from ThomasWaldmann/fix-stats-logging
log stats consistently, fixes #526
2016-01-14 14:33:53 +01:00
Michael Hanselmann
2369b8a0f2 Strip whitespace when loading exclusions from file
Patterns to exclude files can be loaded from a text file using the
“--exclude-from” option. Whitespace at the beginning or end of lines was
not stripped. Indented comments would be interpreted as a pattern and
a misplaced space at the end of a line--some text editors don't strip
them--could cause an exclusion pattern to not match as desired. With the
recent addition of regular expression support for exclusions the spaces
can be matched if necessary (“^\s” or “\s$”), though it's highly
unlikely that there are many paths deliberately starting or ending with
whitespace.
2016-01-13 17:39:22 +01:00
Michael Hanselmann
2bafece093 Implement exclusions using regular expressions
The existing option to exclude files and directories, “--exclude”, is
implemented using fnmatch[1]. fnmatch matches the slash (“/”) with “*”
and thus makes it impossible to write patterns where a directory with
a given name should be excluded at a specific depth in the directory
hierarchy, but not anywhere else. Consider this structure:

  home/
  home/aaa
  home/aaa/.thumbnails
  home/user
  home/user/img
  home/user/img/.thumbnails

fnmatch incorrectly excludes “home/user/img/.thumbnails” with a pattern
of “home/*/.thumbnails” when the intention is to exclude “.thumbnails”
in all home directories while retaining directories with the same name
in all other locations.

With this change regular expressions are introduced as an additional
pattern syntax. The syntax is selected using a prefix on “--exclude”'s
value. “re:” is for regular expression and “fm:”, the default, selects
fnmatch. Selecting the syntax is necessary when regular expressions are
desired or when the desired fnmatch pattern starts with two alphanumeric
characters followed by a colon (i.e. “aa:something/*”). The exclusion
described above can be implemented as follows:

  --exclude 're:^home/[^/]+/\.thumbnails$'

The “--exclude-from” option permits loading exclusions from a text file
where the same prefixes can now be used, e.g. “re:\.tmp$”.

The documentation has been extended and now not only describes the two
pattern styles, but also the file format supported by “--exclude-from”.

This change has been discussed in issue #43 and in change request #497.

[1] https://docs.python.org/3/library/fnmatch.html

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
2016-01-13 17:39:19 +01:00
Michael Hanselmann
93c9c49250 Reduce code duplication in inclusion/exclusion pattern logic
The two classes for applying inclusion and exclusion patterns contained
unnecessarily duplicated logic. The introduction of a shared base class
allows for easier reuse, especially considering that two more classes
are going to be added in forthcoming changes (regular expressions and
shell-style patterns).
2016-01-13 14:35:59 +01:00
Michael Hanselmann
5d40eba175 Convert pattern test to py.test
The test for exclusion patterns was written using the standard unittest
module. The py.test module provides facilities to parametrize the test.
2016-01-13 12:39:37 +01:00
TW
4a9672e8d5 Merge pull request #538 from ThomasWaldmann/fix-library-path
unset LD_LIBRARY_PATH before invoking ssh, hopefully fixes #514
2016-01-12 19:58:04 +01:00
TW
2921b60e69 Merge pull request #539 from ThomasWaldmann/add-version
display borg version below tracebacks, fixes #532
2016-01-12 19:57:41 +01:00
TW
0f02513410 Merge pull request #540 from ThomasWaldmann/isotimestamp-with-wkday
add abbreviated weekday to timestamp format, fixes #496
2016-01-12 19:57:14 +01:00
Michael Hanselmann
98da9d1b96 Dedent pattern help text
The help text describing patterns should be dedented like other
multi-paragraph text blocks.
2016-01-12 17:53:34 +01:00
Thomas Waldmann
84672f7081 log stats consistently, fixes #526
prune and create now both require --verbose --stats to show stats.
it was implemented in this way (and not with print) so you can feed the stats data
into the logging system, too.

delete now says "Archive deleted" in verbose mode (for consistency,
it already said "Repository deleted" when deleting a repo).

also: add helpers.log_multi to comfortably and prettily output a block of log lines
2016-01-12 00:41:06 +01:00
Thomas Waldmann
e5c29bd145 add abbreviated weekday to timestamp format, fixes #496 2016-01-11 23:31:24 +01:00
Thomas Waldmann
857f563307 display borg version below tracebacks, fixes #532 2016-01-11 23:22:04 +01:00
Michael Hanselmann
02e04653b6 Factorize and test loading of excludes from file
The parsing code for exclude files (given via `--exclude-from`) was not
tested. Its core is factorized into a separate function to facilitate an
easier test. The observable behaviour is unchanged.
2016-01-11 12:24:26 +01:00
Thomas Waldmann
170f847e74 unset LD_LIBRARY_PATH before invoking ssh, hopefully fixes #514 2016-01-11 02:08:58 +01:00
Michael Hanselmann
d668901df4 Fix typo in comment 2016-01-07 11:18:03 +01:00
TW
48e9b9cb15 Merge pull request #524 from ThomasWaldmann/libc-loader-fallback
add some error handling/fallback for C library loading, fixes #494
2016-01-06 14:43:17 +01:00
Thomas Waldmann
4ed71e2cf5 add some error handling/fallback for C library loading, fixes #494 2015-12-27 14:10:41 +01:00
Thomas Waldmann
c9afa2b27b output progress indication from inner loop, fixes #500
- so it shows progress while it backups a bigger file
- so it announces the filename earlier

also: move rate limiting code to show_progress()
2015-12-27 11:06:03 +01:00
Thomas Waldmann
57b913bc88 fix badly named environment variable, fixes #503
added: BORG_DELETE_I_KNOW_WHAT_I_AM_DOING for the check in "borg delete"
2015-12-20 02:03:33 +01:00
Thomas Waldmann
95f6cd4a4e Merge branch 'master' of github.com:borgbackup/borg 2015-12-13 14:26:49 +01:00
Thomas Waldmann
0c166898bf fix python 3.2 str.splitlines() compatibility issue 2015-12-13 00:51:39 +01:00
Thomas Waldmann
aa97724c0c add --prefix to check to check only some specific archives, fixes #206 2015-12-13 00:39:52 +01:00
Thomas Waldmann
942120997e log remote exceptions, add remote sysinfo 2015-12-12 22:45:29 +01:00
Thomas Waldmann
2df0bb1f83 remote stderr: keep line endings as is
so even the \r trick works for overwriting the same line.
2015-12-12 22:15:08 +01:00
Thomas Waldmann
2e2e145372 sane remote logging, remote stderr, fixes #461 2015-12-12 22:15:08 +01:00
Thomas Waldmann
229512b6f5 determine log level from the logger, so it works with logging.conf also 2015-12-12 22:15:08 +01:00
Thomas Waldmann
f59db03c60 ProgressIndicator: flush the output file or it won't work correctly via ssh
likely due to buffering, the progress indication was not visible.
2015-12-12 22:15:08 +01:00
Thomas Waldmann
eab60cce99 pass through some global options from client to server
new: logging level options
refactored:
- umask option and remote_path
- cleanly separated ssh command from borg command
2015-12-12 22:15:08 +01:00
Thomas Waldmann
c194f3ca1c give (all) args to open_repository 2015-12-12 22:15:08 +01:00
Thomas Waldmann
9c271afefa unify repo/archive parameter name to "location" 2015-12-12 22:15:08 +01:00
Thomas Waldmann
e3d5898add borg upgrade - use inplace parameter, fixes #466
i checked it: copying the index.* and hints.* files in advance is not needed, open() and close() do not modify them.

also: fix unicode exception with encoded filename
2015-12-11 22:18:18 +01:00
TW
bbeda1f743 Merge pull request #481 from ThomasWaldmann/fix-progress
remove --progress magic, fixes #476
2015-12-10 13:34:02 +01:00
Thomas Waldmann
60babd14c3 borg upgrade - do not overwrite backup_repo/index.*, fixes #466
the code obviously wrote to both index.* files as they were hardlinked.
now we make a normal copy of index (and also hints) to avoid this.
2015-12-10 11:59:13 +01:00