Commit graph

361 commits

Author SHA1 Message Date
Thomas Waldmann
6d5cc06cf6 remove unused imports, add missing imports 2015-11-02 20:36:13 +01:00
Thomas Waldmann
36cc377329 use default_notty=False for confirmations, fixes #345
this is so that e.g. cron jobs do not hang indefinitely if yes() is called,
but it will just default to "no" if not tty is connected.

if you need to enforce a "yes" answer (which is not recommended for
the security critical questions), you can use the environment:

BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=Y
2015-11-02 01:59:22 +01:00
Thomas Waldmann
e6231896cd emit a deprecation warning for --compression N
deprecating it in the source is not enough, we also need to tell the users to fix their scripts.
2015-11-02 00:14:01 +01:00
Thomas Waldmann
35280e9a65 label platform code, exclude freebsd and unknown platform from coverage measurement
this coverage configuration is mostly for travis and there we only can test linux and darwin.
2015-11-01 23:06:52 +01:00
Thomas Waldmann
0a6e6cfe2e refactor confirmation code, reduce code duplication, add tests 2015-11-01 19:18:29 +01:00
Thomas Waldmann
36900051c5 move test utilities to testsuite package, add FakeInputs utility 2015-11-01 19:13:45 +01:00
Thomas Waldmann
4a1c995244 add --show-rc option enable "terminating with X status, rc N" output, fixes #351
this is needed for tools like borgweb (or in general: when the rc value / exit status should
be logged for later review or directly seen on screen).

this is off by default, so the output is less verbose (and also does not fail tests which
counts lines).
2015-11-01 00:53:55 +01:00
Thomas Waldmann
4bf8c8a6f8 separate parse_args() from run()
parse_args concentrates on only processing arguments, including pre and post processing.
this needs to be called before run(), which is now receiving the return value of parse_args.

this was done so we can have the parsed args outside of the run function, e.g. in main().
2015-11-01 00:40:32 +01:00
Thomas Waldmann
7ea701f6f7 fix test failure for borg.exe
fatal error is rc 2 now (EXIT_ERROR)
2015-11-01 00:01:23 +01:00
TW
f651b014e6 Merge pull request #350 from ThomasWaldmann/fix-307
prettier connection closed message, fixes #307
2015-10-31 23:19:26 +01:00
TW
5f86959762 Merge pull request #349 from ThomasWaldmann/pretty-errors
prettier error messages, fixes #57
2015-10-31 22:44:04 +01:00
TW
39e4f344bd Merge pull request #348 from ThomasWaldmann/warn-slow-msgpack
emit a warning if we have a slow msgpack installed
2015-10-31 22:43:36 +01:00
Thomas Waldmann
1740384763 prettier connection closed message, fixes #307 2015-10-31 22:41:08 +01:00
Thomas Waldmann
762fdaadd8 prettier error messages, fixes #57
subclasses of "Error": do not show traceback
(this is used when a failure is expected and has rather trivial reasons and usually
does not need debugging)

subclasses of "ErrorWithTraceback": show a traceback
(this is for severe and rather unexpected stuff, like consistency / corruption issues
or stuff that might need debugging)

I reviewed all the Error subclasses whether they fit into the one or other class.

Also: fixed docstring typo, docstring formatting
2015-10-31 22:23:32 +01:00
Thomas Waldmann
3490469734 emit a warning if we have a slow msgpack installed
the reason for a slow msgpack can be:
- pip install: missing compiler (gcc)
- pip install: missing compiler parts (e.g. gcc-c++)
- pip install: cached wheel package that was built while the compiler wasn't present
- distribution package: badly built msgpack package
2015-10-31 20:37:21 +01:00
Radek Podgorny
5cc25d986a move away from RawConfigParser to ConfigParser
this is a recommended thing since direct use of RawConfigParser
is not deprecated according to python docs.
2015-10-29 02:37:43 +01:00
Thomas Waldmann
5992d4be58 Merge branch 'review-logging-levels' 2015-10-28 02:02:33 +01:00
Thomas Waldmann
dd577bf4ac fuse mount: fix unlocking of repository at umount time, fixes #331
there were 2 issues:
lock used another pid and tid than release because daemonize() made it different processes/threads.
solved by just determining PID only once and not using TID any more.

the other issue was that the repo needed and explicit closing.
2015-10-27 22:37:36 +01:00
Thomas Waldmann
92d31be087 atime unit test: test adapts to O_NOATIME support on platform 2015-10-26 23:16:41 +01:00
Thomas Waldmann
3e73998710 atime unit test: do not compare input file's current atime
and explain why (missing O_NOATIME open mode modified the atime at backup time).
2015-10-26 23:08:37 +01:00
Thomas Waldmann
765999195d atime unit test: hardcode "round" timestamps
just to avoid rounding / precision issues with floating point computations on py < 3.3
I used 2 hardcoded "full second" values on the input file and check if they get restored
correctly.
2015-10-26 22:34:08 +01:00
Thomas Waldmann
c492011a92 backup atime and ctime additionally to mtime, fixes #317
restore: mtime and atime
FUSE: support ctime and atime additionally to mtime
2015-10-26 02:07:55 +01:00
Thomas Waldmann
0942bc010e fix reading files without touching their atime 2015-10-26 01:43:58 +01:00
Thomas Waldmann
f7d724ce33 tests: only use mtime once in directory comparison tuples 2015-10-26 01:37:28 +01:00
Thomas Waldmann
f285e90912 archiver: add E status as error indication
E means that an error occured when processing this (single) item
2015-10-25 02:53:36 +02:00
Thomas Waldmann
7b73abdcda archiver: rename print_x methods so they correspond to log levels
also:

remove some "Warning: " msg prefixes - if we emit at WARNING level,
it is obviously a warning.

remove some "borg: " msg prefixes.
2015-10-25 02:35:42 +02:00
Thomas Waldmann
d8d3c8521b fix logging levels
All normal informational output is now logged at INFO level.
To actually see normal output, the logger is configured to level INFO also.

Log levels:
WARNING is for warnings, ERROR is for (fatal) errors, DEBUG is for debugging.

logging levels must only be used according to this semantics and must not be
(ab)used to let something show up (although the logger would usually hide it)
or hide something (although the logger would usually show it).

Controlling the amount of output shown on INFO level:
--verbose, --progress, --stats are currently used for this.
more such flags might be added later as needed.

if they are set, more output is logged (at INFO level).

also: change strange setup_logging return value
2015-10-23 02:29:41 +02:00
TW
52fd2ad3da Merge pull request #320 from ThomasWaldmann/final-status
Final status
2015-10-22 01:04:36 +02:00
Thomas Waldmann
5bcd4835e6 add tests for return codes 2015-10-22 00:45:29 +02:00
Antoine Beaupré
bfaa046a31 add standard --version argument
this way the version can be discovered by scripts without having to
part the output of 'help'.

it is removed from the 'help' output itself because it is prettier
without the complete version number, and then the description can be
reused elsewhere as well without needing the version number
2015-10-21 09:58:28 -04:00
TW
557d8c7e03 Merge pull request #318 from anarcat/flake8
small flake8 changes
2015-10-21 02:15:22 +02:00
Antoine Beaupré
05c4255620 flake8 cleanup broke the upgrader, re-import Repository 2015-10-20 19:54:57 -04:00
Thomas Waldmann
72c984891c refactor return codes, fixes #61
0 = success (logged as INFO)
1 = warning (logged as WARNING)
2 = (fatal and abrupt) error (logged as ERROR)

please use the EXIT_(SUCCESS,WARNING,ERROR) constants from helpers module.
2015-10-21 01:11:51 +02:00
Thomas Waldmann
1439f3be60 give a final status into the log output, including exit code, fixes #58 2015-10-20 23:57:56 +02:00
Thomas Waldmann
af2366693a tests: catch stderr also, some tests expect stderr contents in "output"
weird: the remote archive fuse tests deadlock, that's why I replaced them by dummies
2015-10-20 22:46:47 +02:00
Antoine Beaupré
8651f87fa1 fix flake8 warnings in my recent PRs 2015-10-20 14:43:49 -04:00
Antoine Beaupré
aad6afb3e0 pep8 the whole darn helpers module 2015-10-20 13:39:21 -04:00
Antoine Beaupré
21fdc91995 clarify size tests 2015-10-20 13:04:01 -04:00
Antoine Beaupré
416e42335c introduce variable precision 2015-10-20 13:01:39 -04:00
Antoine Beaupré
c7c1b9222b convert to more flexible size formatters
those can now support both file sizes (in SI/decimal format, powers of 10) and memory sizes (in binary format, powers of 2)

tests still fail because the result is always displayed as floats
2015-10-20 13:01:14 -04:00
Antoine Beaupré
de390b1ca6 add file size tests, failing
the tests are failing because 1KB gets displayed as 1000 bytes, but also because higher prefixes are missing
2015-10-20 13:01:14 -04:00
TW
21f26988cc Merge pull request #303 from anarcat/verbosity
Verbosity
2015-10-19 22:25:46 +02:00
Antoine Beaupré
38bde26673 remove needless double type conversion
i got confused and thought i was setting the environment (in which case you need to cast to str anyways, so this was wrong even then)
2015-10-19 15:47:05 -04:00
Antoine Beaupré
a3084b7174 try to fix build on py32 again 2015-10-19 14:41:02 -04:00
Antoine Beaupré
12d22d5940 try to fix build on py32 2015-10-19 09:10:45 -04:00
Antoine Beaupré
f9bccd1987 revert policy decision of showing all files listing only on debug 2015-10-19 09:10:19 -04:00
Antoine Beaupré
49d7c240a0 cosmetic: don't word-wrap needlessly 2015-10-19 09:10:04 -04:00
Thomas Waldmann
7d31da7914 implement cmdline metadata value decoding
code copied & adapted from Archive.load()
2015-10-19 12:16:28 +02:00
Thomas Waldmann
af2f1f7861 remove a fixed FIXME
see a few lines below, where it renames the original file to *.beforerecover before creating the repaired copy using the old name.
2015-10-19 11:57:12 +02:00
TW
79482a1c46 Merge pull request #310 from ThomasWaldmann/non-ascii-acls
Non ascii acls
2015-10-19 11:39:15 +02:00