Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --delay-updates option #34

Merged
merged 1 commit into from Feb 19, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions S3/Config.py
Expand Up @@ -54,6 +54,7 @@ class Config(object):
]
delete_removed = 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 @@ -262,7 +262,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 @@ -272,6 +272,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 @@ -331,10 +332,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