Merge lp:~thomas-ross/duplicity/b2-hide-files into lp:~duplicity-team/duplicity/0.8-series

Proposed by Thomas Ross
Status: Merged
Merge reported by: Kenneth Loafman
Merged at revision: not available
Proposed branch: lp:~thomas-ross/duplicity/b2-hide-files
Merge into: lp:~duplicity-team/duplicity/0.8-series
Diff against target: 73 lines (+20/-3)
4 files modified
bin/duplicity.1 (+5/-0)
duplicity/backends/b2backend.py (+9/-3)
duplicity/commandline.py (+3/-0)
duplicity/config.py (+3/-0)
To merge this branch: bzr merge lp:~thomas-ross/duplicity/b2-hide-files
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+383164@code.launchpad.net

Commit message

Add option --b2-hide-files that causes the B2 backend to hide files instead of deleting them

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/duplicity.1'
2--- bin/duplicity.1 2020-03-19 20:33:09 +0000
3+++ bin/duplicity.1 2020-04-29 18:59:27 +0000
4@@ -348,6 +348,11 @@
5 .BR cloudfiles .
6
7 .TP
8+.BI --b2-hide-files
9+Causes Duplicity to hide files in B2 instead of deleting them. Useful in
10+combination with B2's lifecycle rules.
11+
12+.TP
13 .BI --compare-data
14 Enable data comparison of regular files on action verify. This conducts a
15 verify as described above to verify the integrity of the backup archives,
16
17=== modified file 'duplicity/backends/b2backend.py'
18--- duplicity/backends/b2backend.py 2020-03-31 21:43:45 +0000
19+++ duplicity/backends/b2backend.py 2020-04-29 18:59:27 +0000
20@@ -32,6 +32,7 @@
21 from duplicity import log
22 from duplicity import progress
23 from duplicity import util
24+from duplicity import config
25 from duplicity.errors import BackendException, FatalBackendException
26 import duplicity.backend
27
28@@ -143,9 +144,14 @@
29 u"""
30 Delete filename from remote server
31 """
32- log.Log(u"Delete: %s" % self.path + util.fsdecode(filename), log.INFO)
33- file_version_info = self.file_info(quote_plus(self.path + util.fsdecode(filename), u'/'))
34- self.bucket.delete_file_version(file_version_info.id_, file_version_info.file_name)
35+ full_filename = self.path + util.fsdecode(filename)
36+ log.Log(u"Delete: %s" % full_filename, log.INFO)
37+
38+ if config.b2_hide_files:
39+ self.bucket.hide_file(full_filename)
40+ else:
41+ file_version_info = self.file_info(quote_plus(full_filename, u'/'))
42+ self.bucket.delete_file_version(file_version_info.id_, file_version_info.file_name)
43
44 def _query(self, filename):
45 u"""
46
47=== modified file 'duplicity/commandline.py'
48--- duplicity/commandline.py 2020-03-21 20:50:35 +0000
49+++ duplicity/commandline.py 2020-04-29 18:59:27 +0000
50@@ -581,6 +581,9 @@
51 # allow the user to switch cloudfiles backend
52 parser.add_option(u"--cf-backend", metavar=_(u"pyrax|cloudfiles"))
53
54+ # Option that causes the B2 backend to hide files instead of deleting them
55+ parser.add_option(u"--b2-hide-files", action=u"store_true")
56+
57 # If set, use short (< 30 char) filenames for all the remote files.
58 parser.add_option(u"--short-filenames", action=u"callback",
59 dest=u"short_filenames",
60
61=== modified file 'duplicity/config.py'
62--- duplicity/config.py 2020-03-21 20:50:35 +0000
63+++ duplicity/config.py 2020-04-29 18:59:27 +0000
64@@ -291,6 +291,9 @@
65 # default cf backend is pyrax
66 cf_backend = u"pyrax"
67
68+# default to fully deleting files in b2
69+b2_hide_files = False
70+
71 # HTTPS ssl options (currently only webdav, lftp)
72 ssl_cacert_file = None
73 ssl_cacert_path = None

Subscribers

People subscribed via source and target branches