Skip to content

Commit

Permalink
add --delay-updates option
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Domsch authored and mdomsch committed Jun 19, 2012
1 parent d192937 commit c3deb6a
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 146 deletions.
1 change: 1 addition & 0 deletions S3/Config.py
Expand Up @@ -55,6 +55,7 @@ class Config(object):
delete_removed = False
delete_after = False
_doc['delete_removed'] = "[sync] Remove remote S3 objects when local file has been deleted"
delay_updates = False
gpg_passphrase = ""
gpg_command = ""
gpg_encrypt = "%(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s"
Expand Down
12 changes: 10 additions & 2 deletions S3/FileLists.py
Expand Up @@ -323,7 +323,7 @@ def _get_filelist_remote(remote_uri, recursive = True):
remote_list[key] = remote_item
return remote_list

def compare_filelists(src_list, dst_list, src_remote, dst_remote):
def compare_filelists(src_list, dst_list, src_remote, dst_remote, delay_updates = False):
def __direction_str(is_remote):
return is_remote and "remote" or "local"

Expand All @@ -333,6 +333,7 @@ def __direction_str(is_remote):
info(u"Verifying attributes...")
cfg = Config()
exists_list = SortedDict(ignore_case = False)
update_list = SortedDict(ignore_case = False)

debug("Comparing filelists (direction: %s -> %s)" % (__direction_str(src_remote), __direction_str(dst_remote)))
debug("src_list.keys: %s" % src_list.keys())
Expand Down Expand Up @@ -392,10 +393,17 @@ def __direction_str(is_remote):
debug(u"IGNR: %s (transfer not needed)" % file)
exists_list[file] = src_list[file]
del(src_list[file])
else:
if delay_updates:
## Remove from source-list, all that is left there will be transferred
## Add to update-list to transfer last
debug(u"XFER UPDATE: %s" % file)
update_list[file] = src_list[file]
del(src_list[file])

## Remove from destination-list, all that is left there will be deleted
del(dst_list[file])

return src_list, dst_list, exists_list
return src_list, dst_list, exists_list, update_list

# vim:et:ts=4:sts=4:ai

0 comments on commit c3deb6a

Please sign in to comment.