Merge lp:~mterry/duplicity/more-accurate-sync into lp:duplicity/0.6

Proposed by Michael Terry
Status: Merged
Merged at revision: 762
Proposed branch: lp:~mterry/duplicity/more-accurate-sync
Merge into: lp:duplicity/0.6
Diff against target: 64 lines (+13/-19)
1 file modified
duplicity-bin (+13/-19)
To merge this branch: bzr merge lp:~mterry/duplicity/more-accurate-sync
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+68884@code.launchpad.net

Description of the change

The current sync'ing code breaks down a bit if you don't correctly tell duplicity whether to use encryption.

You'll see that if you have an archive of unencrypted backups, clear your cache, then run, say, collection-status against the archive (without passing --no-encryption), that you'll get an error saying duplicity couldn't find duplicity-full-signatures...sigtar.gpg on the backend. Which doesn't really tell the user much about why they are seeing that error.

The reason is because duplicity breaks down what it sees on the backend (sigtar.gz) then builds a filename back up again based on what it would expect to see due to the command line (in this case, sigtar.gpg). This seems a bit willfully ignorant of information it already has.

This branch will always sync what is actually on the remote end, not what we thought would be there.

Of course, the rest of duplicity will handle the mismatch with more or less grace, but this particular error seemed obscure and unnecessary.

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 'duplicity-bin'
2--- duplicity-bin 2011-07-08 18:14:35 +0000
3+++ duplicity-bin 2011-07-22 17:33:26 +0000
4@@ -877,24 +877,18 @@
5 @return: (parsedresult, local_name, remote_name)
6 """
7 pr = file_naming.parse(fn)
8- if pr.manifest:
9- suffix = file_naming.get_suffix(globals.encryption, False)
10- else:
11- suffix = file_naming.get_suffix(globals.encryption, not globals.encryption)
12- rem_name = fn + suffix
13-
14- if pr.manifest:
15- suffix = file_naming.get_suffix(False, False)
16- else:
17- suffix = file_naming.get_suffix(False, True)
18- loc_name = fn + suffix
19-
20- return (pr, loc_name, rem_name)
21+
22+ base, ext = os.path.splitext(fn)
23+ if ext not in suffixes:
24+ base = fn
25+
26+ suffix = file_naming.get_suffix(False, not pr.manifest)
27+ loc_name = base + suffix
28+
29+ return (pr, loc_name, fn)
30
31 def remove_local(fn):
32- pr, loc_name, rem_name = resolve_basename(fn)
33-
34- del_name = globals.archive_dir.append(loc_name).name
35+ del_name = globals.archive_dir.append(fn).name
36
37 log.Notice(_("Deleting local %s (not authoritative at backend).") % del_name)
38 try:
39@@ -943,7 +937,7 @@
40
41 pr, loc_name, rem_name = resolve_basename(fn)
42
43- fileobj = globals.backend.get_fileobj_read(rem_name)
44+ fileobj = globals.backend.get_fileobj_read(fn)
45 src_iter = SrcIter(fileobj)
46 if pr.manifest:
47 copy_raw(src_iter,
48@@ -976,14 +970,14 @@
49 # complete in this case (seems we got interrupted before we could move
50 # it to its final location).
51 if key not in local_keys and key not in local_partials:
52- local_missing.append(key)
53+ local_missing.append(remote_metafiles[key])
54
55 for key in local_keys:
56 # If we have a file locally that is unnecessary, delete it. Also
57 # delete final versions of partial files because if we have both, it
58 # means the write of the final version got interrupted.
59 if key not in remote_keys or key in local_partials:
60- local_spurious.append(key)
61+ local_spurious.append(local_metafiles[key])
62
63 # finally finish the process
64 if not local_missing and not local_spurious:

Subscribers

People subscribed via source and target branches

to all changes: