← Back to team overview

duplicity-team team mailing list archive

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

 

Michael Terry has proposed merging lp:~mterry/duplicity/more-accurate-sync into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/more-accurate-sync/+merge/68884

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.
-- 
https://code.launchpad.net/~mterry/duplicity/more-accurate-sync/+merge/68884
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/more-accurate-sync into lp:duplicity.
=== modified file 'duplicity-bin'
--- duplicity-bin	2011-07-08 18:14:35 +0000
+++ duplicity-bin	2011-07-22 17:33:26 +0000
@@ -877,24 +877,18 @@
         @return: (parsedresult, local_name, remote_name)
         """
         pr = file_naming.parse(fn)
-        if pr.manifest:
-            suffix = file_naming.get_suffix(globals.encryption, False)
-        else:
-            suffix = file_naming.get_suffix(globals.encryption, not globals.encryption)
-        rem_name = fn + suffix
-
-        if pr.manifest:
-            suffix = file_naming.get_suffix(False, False)
-        else:
-            suffix = file_naming.get_suffix(False, True)
-        loc_name = fn + suffix
-
-        return (pr, loc_name, rem_name)
+
+        base, ext = os.path.splitext(fn)
+        if ext not in suffixes:
+            base = fn
+
+        suffix = file_naming.get_suffix(False, not pr.manifest)
+        loc_name = base + suffix
+
+        return (pr, loc_name, fn)
 
     def remove_local(fn):
-        pr, loc_name, rem_name = resolve_basename(fn)
-
-        del_name = globals.archive_dir.append(loc_name).name
+        del_name = globals.archive_dir.append(fn).name
 
         log.Notice(_("Deleting local %s (not authoritative at backend).") % del_name)
         try:
@@ -943,7 +937,7 @@
 
         pr, loc_name, rem_name = resolve_basename(fn)
 
-        fileobj = globals.backend.get_fileobj_read(rem_name)
+        fileobj = globals.backend.get_fileobj_read(fn)
         src_iter = SrcIter(fileobj)
         if pr.manifest:
             copy_raw(src_iter,
@@ -976,14 +970,14 @@
         # complete in this case (seems we got interrupted before we could move
         # it to its final location).
         if key not in local_keys and key not in local_partials:
-            local_missing.append(key)
+            local_missing.append(remote_metafiles[key])
 
     for key in local_keys:
         # If we have a file locally that is unnecessary, delete it.  Also
         # delete final versions of partial files because if we have both, it
         # means the write of the final version got interrupted.
         if key not in remote_keys or key in local_partials:
-            local_spurious.append(key)
+            local_spurious.append(local_metafiles[key])
 
     # finally finish the process
     if not local_missing and not local_spurious:


Follow ups